From 1e568bb1b36cc45bb34b593eedb21e93ae4027c6 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sun, 22 Feb 2026 03:16:14 +0000 Subject: [PATCH] Add timeout to PGCR processing --- apps/atlas/worker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/atlas/worker.go b/apps/atlas/worker.go index da3b5b3..9808f6e 100644 --- a/apps/atlas/worker.go +++ b/apps/atlas/worker.go @@ -41,7 +41,11 @@ func (w *AtlasWorker) Run(wg *sync.WaitGroup, ch chan int64) { i := 0 for { - result, instance, pgcr := pgcr_processing.FetchAndProcessPGCR(context.Background(), instanceID, malformedRetryCount) + // Create a context with timeout to prevent indefinite retries when the API is slow + // 3 minutes allows for multiple retry attempts while preventing endless loops + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + result, instance, pgcr := pgcr_processing.FetchAndProcessPGCR(ctx, instanceID, malformedRetryCount) + cancel() // Clean up the context statusStr := fmt.Sprintf("%d", result) attemptsStr := fmt.Sprintf("%d", i+1)