From 3096786454d868dd8a21bc861991b9ce6dd2bc85 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Sat, 30 Apr 2022 01:03:53 -0600 Subject: [PATCH] backfill queue: interrupt sending to deferred channel on queue re-check If a queue re-check is requested, interrupt sending the backfill request to the deferred channel so that immediate backfills can happen ASAP. --- backfillqueue.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backfillqueue.go b/backfillqueue.go index 4a1c651..57ad1a6 100644 --- a/backfillqueue.go +++ b/backfillqueue.go @@ -40,7 +40,14 @@ func (bq *BackfillQueue) RunLoop(user *User) { if backfill.BackfillType == database.BackfillImmediate || backfill.BackfillType == database.BackfillForward { bq.ImmediateBackfillRequests <- backfill } else { - bq.DeferredBackfillRequests <- backfill + select { + case <-bq.ReCheckQueue: + // If a queue re-check is requested, interrupt sending the + // backfill request to the deferred channel so that + // immediate backfills can happen ASAP. + continue + case bq.DeferredBackfillRequests <- backfill: + } } backfill.MarkDone() } else {