diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-15 12:39:08 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-24 16:52:49 +0300 |
commit | de764b05589ec73e1aa9ddd2d7118ced301602f0 (patch) | |
tree | 1a2b4a22c0bb7f4daeb900df448a843f0fbf69e9 | |
parent | 7b5acbe6ed71a017d9075df9b25ab58044476b98 (diff) |
nodes: Silence warnings about ignored errors for `checkNodes()`
Both the local and SQL electors don't check errors returned by
`checkNodes()`. While we could convert all sites to properly do this, it
doesn't really feel worth it: both electors only exist due to legacy
reasons and should not be used in production systems at all.
Ignore most of those errors inline so that we can remove the excemptions
from golangci-lint's config file.
-rw-r--r-- | .golangci.yml | 12 | ||||
-rw-r--r-- | internal/praefect/nodes/local_elector.go | 6 | ||||
-rw-r--r-- | internal/praefect/nodes/manager.go | 3 | ||||
-rw-r--r-- | internal/praefect/nodes/sql_elector.go | 5 |
4 files changed, 13 insertions, 13 deletions
diff --git a/.golangci.yml b/.golangci.yml index 226847520..417897f8c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -79,18 +79,6 @@ issues: text: "Error return value of `[^`]+.(Close|Serve)` is not checked" - linters: - errcheck - path: "internal/praefect/nodes/local_elector.go" - text: "Error return value of `s.checkNodes` is not checked" - - linters: - - errcheck - path: "internal/praefect/nodes/manager.go" - text: "Error return value of `strategy.checkNodes` is not checked" - - linters: - - errcheck - path: "internal/praefect/nodes/sql_elector.go" - text: "Error return value of `s.checkNodes` is not checked" - - linters: - - errcheck path: "internal/middleware/limithandler/limithandler.go" text: "Error return value of `limiter.Limit` is not checked" - linters: diff --git a/internal/praefect/nodes/local_elector.go b/internal/praefect/nodes/local_elector.go index bea1ef68b..95c2c3f35 100644 --- a/internal/praefect/nodes/local_elector.go +++ b/internal/praefect/nodes/local_elector.go @@ -52,7 +52,11 @@ func (s *localElector) bootstrap(d time.Duration) { <-timer.C ctx := context.TODO() - s.checkNodes(ctx) + + if err := s.checkNodes(ctx); err != nil { + s.log.WithError(err).Warn("error checking nodes") + } + timer.Reset(d) } } diff --git a/internal/praefect/nodes/manager.go b/internal/praefect/nodes/manager.go index f7578cfbf..e57abeb0b 100644 --- a/internal/praefect/nodes/manager.go +++ b/internal/praefect/nodes/manager.go @@ -229,6 +229,9 @@ func (n *Mgr) Stop() { func (n *Mgr) checkShards() { for _, strategy := range n.strategies { ctx := context.Background() + + //nolint:errcheck // We don't care for this error. The nodes manager is only + // used for the deprecated SQL elector anyway. strategy.checkNodes(ctx) } } diff --git a/internal/praefect/nodes/sql_elector.go b/internal/praefect/nodes/sql_elector.go index fb976a3ed..b3adf2d8c 100644 --- a/internal/praefect/nodes/sql_elector.go +++ b/internal/praefect/nodes/sql_elector.go @@ -144,6 +144,8 @@ func (s *sqlElector) stop() { func (s *sqlElector) bootstrap(d time.Duration) { ctx := context.Background() + //nolint:errcheck // We don't care for this error. The nodes manager is only + // used for the deprecated SQL elector anyway. s.checkNodes(ctx) } @@ -159,6 +161,9 @@ func (s *sqlElector) monitor(d time.Duration) { return case <-ticker.C: } + + //nolint:errcheck // We don't care for this error. The nodes manager is only + // used for the deprecated SQL elector anyway. s.checkNodes(ctx) } } |