Skip to content

Commit ca41162

Browse files
authored
chore: suppress context.DeadlineExceeded errors in the api event publishing (#2171)
Signed-off-by: Alessandro Yuichi Okimoto <yuichijpn@gmail.com>
1 parent 7500951 commit ca41162

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed

pkg/api/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ func (s *gatewayService) registerEvents(w http.ResponseWriter, req *http.Request
819819
} else {
820820
nonRepeateableErrors++
821821
}
822-
if !errors.Is(err, context.Canceled) {
822+
if !errors.Is(err, context.Canceled) && !errors.Is(err, context.DeadlineExceeded) {
823823
s.logger.Error(
824824
"Failed to publish event",
825825
log.FieldsFromIncomingContext(req.Context()).AddFields(

pkg/api/api/api_grpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ func (s *grpcGatewayService) RegisterEvents(
13191319
} else {
13201320
nonRepeateableErrors++
13211321
}
1322-
if !errors.Is(err, context.Canceled) {
1322+
if !errors.Is(err, context.Canceled) && !errors.Is(err, context.DeadlineExceeded) {
13231323
s.logger.Error(
13241324
"Failed to publish event",
13251325
log.FieldsFromIncomingContext(ctx).AddFields(

pkg/batch/jobs/calculator/experiment_calculate.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ func (e *experimentCalculate) runCalculation() {
107107
ctxWithTimeout, cancel := context.WithTimeout(context.Background(), e.opts.Timeout)
108108
defer cancel() // Ensure context is canceled when goroutine completes
109109
var err error
110-
e.logger.Info("Started experiment calculation job")
111110
startTime := time.Now().In(e.location)
112111
defer func() {
113112
jobs.RecordJob(jobs.JobExperimentCalculator, err, time.Since(startTime))

pkg/rpc/gateway/gateway.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,6 @@ func (g *Gateway) Stop(timeout time.Duration) {
424424
zap.Duration("timeout", timeout),
425425
zap.Duration("elapsed", time.Since(startTime)),
426426
)
427-
} else {
428-
g.logger.Info("HTTP grpc-gateway server shutdown completed",
429-
zap.Duration("elapsed", time.Since(startTime)),
430-
)
431427
}
432428
}
433429
}

pkg/subscriber/processor/evaluation_events_evaluation_count_event_persister.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,10 @@ func (p *evaluationCountEventPersister) cacheEnvLastUsedInfo(
361361
p.envLastUsedCacheMutex.Lock()
362362
defer p.envLastUsedCacheMutex.Unlock()
363363
var clientVersion string
364-
if event.User == nil {
365-
p.logger.Warn("Failed to cache last used info. User is nil.",
366-
zap.String("environmentId", environmentId))
367-
} else {
368-
clientVersion = event.User.Data[userDataAppVersion]
364+
if event.User != nil {
365+
if version, ok := event.User.Data[userDataAppVersion]; ok {
366+
clientVersion = version
367+
}
369368
}
370369
id := ftdomain.FeatureLastUsedInfoID(event.FeatureId, event.FeatureVersion)
371370
if cache, ok := p.envLastUsedCache[environmentId]; ok {

0 commit comments

Comments
 (0)