mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-11-12 04:52:40 +01:00
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.
This commit is contained in:
parent
89131bd20c
commit
3096786454
1 changed files with 8 additions and 1 deletions
|
@ -40,7 +40,14 @@ func (bq *BackfillQueue) RunLoop(user *User) {
|
||||||
if backfill.BackfillType == database.BackfillImmediate || backfill.BackfillType == database.BackfillForward {
|
if backfill.BackfillType == database.BackfillImmediate || backfill.BackfillType == database.BackfillForward {
|
||||||
bq.ImmediateBackfillRequests <- backfill
|
bq.ImmediateBackfillRequests <- backfill
|
||||||
} else {
|
} 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()
|
backfill.MarkDone()
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue