瀏覽代碼

backfill: re-dispatch if 15 minutes have elapsed

If 15 minutes have passed since the backfill request was dispatched and
backfill hasn't completed, then re-dispatch.
Sumner Evans 3 年之前
父節點
當前提交
feb9f71cb5
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      database/backfillqueue.go

+ 7 - 1
database/backfillqueue.go

@@ -82,7 +82,13 @@ const (
 		FROM backfill_queue
 		WHERE user_mxid=$1
 			AND type IN (%s)
-			AND dispatch_time IS NULL
+			AND (
+				dispatch_time IS NULL
+				OR (
+					dispatch_time < current_timestamp - interval '15 minutes'
+					AND completed_at IS NULL
+				)
+			)
 		ORDER BY type, priority, queue_id
 		LIMIT 1
 	`