File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,13 @@ public object Any(RestoreModelQueues request)
39
39
var incompleteJobs = Db . Select ( Db . From < PostJob > ( ) . Where ( x => x . CompletedDate == null ) ) ;
40
40
var missingJobs = incompleteJobs . Where ( x => ! pendingJobIds . Contains ( x . Id ) && x . StartedDate == null ) . ToList ( ) ;
41
41
var startedJobs = incompleteJobs . Where ( x => x . StartedDate != null ) . ToList ( ) ;
42
+ var lostJobsBefore = DateTime . UtcNow . Add ( TimeSpan . FromMinutes ( - 5 ) ) ;
43
+ var lostJobs = startedJobs . Where ( x => x . StartedDate < lostJobsBefore && missingJobs . All ( m => m . Id != x . Id ) ) . ToList ( ) ;
42
44
45
+ foreach ( var lostJob in lostJobs )
46
+ {
47
+ workerQueues . Enqueue ( lostJob ) ;
48
+ }
43
49
foreach ( var missingJob in missingJobs )
44
50
{
45
51
workerQueues . Enqueue ( missingJob ) ;
@@ -51,7 +57,7 @@ public object Any(RestoreModelQueues request)
51
57
$ "{ pendingJobs . Count } pending jobs in queue",
52
58
$ "{ incompleteJobs . Count } incomplete jobs in database",
53
59
$ "{ startedJobs . Count } jobs being processed by workers",
54
- $ "{ missingJobs . Count } jobs missing and re-added to queue",
60
+ $ "{ missingJobs . Count } missing and $ { lostJobs . Count } lost jobs re-added to queue",
55
61
]
56
62
} ;
57
63
}
You can’t perform that action at this time.
0 commit comments