Skip to content

Commit 2c75552

Browse files
committed
don't attempt to distinguish between errors, just keep retrying
1 parent 7fb0138 commit 2c75552

2 files changed

Lines changed: 3 additions & 57 deletions

File tree

internal/pkg/coordinator/monitor.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"errors"
1010
"net"
1111
"os"
12-
"regexp"
1312
"runtime"
1413
"sync"
1514
"time"
@@ -189,31 +188,15 @@ func (m *monitorT) handlePolicies(ctx context.Context, hits []es.HitT) error {
189188
return nil
190189
}
191190

192-
func isAvailabilityError(e error) bool {
193-
if e == nil {
194-
return false
195-
}
196-
match, err := regexp.MatchString("connect: connection refused$|net/http: timeout awaiting response headers$", e.Error())
197-
if err != nil {
198-
log.Warn().Err(err).Msg("Error occured while parsing error message")
199-
return false
200-
}
201-
return match
202-
}
203-
204191
// ensureLeadership ensures leadership is held or needs to be taken over.
205192
func (m *monitorT) ensureLeadership(ctx context.Context) error {
206193
m.log.Debug().Msg("ensuring leadership of policies")
207194
err := dl.EnsureServer(ctx, m.bulker, m.version, m.agentMetadata, m.hostMetadata, dl.WithIndexName(m.serversIndex))
208195

209-
// If we are doing a read on an unavailable ES instance ignore it and we will check back later.
210-
if isAvailabilityError(err) {
211-
log.Info().Err(err).Msgf("Encountered availability error while attempting ES read; continuing to retry.")
212-
return nil
213-
}
214-
196+
// If we run into problems communicating with our ES instance, ignore it and we will check back later.
215197
if err != nil {
216-
return err
198+
log.Info().Err(err).Msgf("Encountered an error while trying to commnuicate with Elasticsearch host %s; continuing to retry.", m.hostMetadata.Name)
199+
return nil
217200
}
218201

219202
// fetch current policies and leaders

internal/pkg/coordinator/monitor_test.go

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)