From 127c3e033eb472b0f00a6d6de3b66c6695e31727 Mon Sep 17 00:00:00 2001 From: Timo Reimann Date: Thu, 26 Sep 2024 12:44:25 +0200 Subject: [PATCH] Short-circuit Slack sync runs on context expiry There is no value in trying to complete remaining Slack syncs if the context has expired. --- syncer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncer.go b/syncer.go index 20352e1..da84cd4 100644 --- a/syncer.go +++ b/syncer.go @@ -115,7 +115,7 @@ func (s *syncer) Run(ctx context.Context, slackSyncs []runSlackSync, failFast bo err := s.runSlackSync(ctx, slackSync) if err != nil { msg := fmt.Sprintf("failed to run Slack sync %s: %s", slackSync.name, err) - if failFast { + if failFast || ctx.Err() != nil { return errors.New(msg) }