From 837eae1f78ae9946244f65b5eff9e083f0ce8bab Mon Sep 17 00:00:00 2001 From: Wes Date: Mon, 22 Jul 2024 11:35:53 -0700 Subject: [PATCH] fix: gracefully handle context cancelation when polling deployments (#2127) --- backend/controller/dal/notify.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/controller/dal/notify.go b/backend/controller/dal/notify.go index e76d3d13d0..2bcb150083 100644 --- a/backend/controller/dal/notify.go +++ b/backend/controller/dal/notify.go @@ -84,7 +84,11 @@ func (d *DAL) PollDeployments(ctx context.Context) { deployments, err := d.GetDeploymentsWithMinReplicas(ctx) if err != nil { - logger.Errorf(err, "failed to get deployments") + if ctx.Err() == context.Canceled { + logger.Debugf("Polling stopped: %v", ctx.Err()) + return + } + logger.Errorf(err, "failed to get deployments when polling") time.Sleep(retry.Duration()) continue }