File tree Expand file tree Collapse file tree
src/Presentation/SmartStore.Web/Controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,14 +44,14 @@ public ActionResult Sweep()
4444 var prevTaskStart = DateTime . UtcNow ;
4545 var count = 0 ;
4646
47- foreach ( var task in pendingTasks )
47+ for ( var i = 0 ; i < pendingTasks . Count ; i ++ )
4848 {
49- var elapsedSincePrevTask = DateTime . UtcNow - prevTaskStart ;
50- if ( elapsedSincePrevTask >= TimeSpan . FromMinutes ( _taskScheduler . SweepIntervalMinutes ) )
49+ var task = pendingTasks [ i ] ;
50+
51+ if ( i > 0 )
5152 {
52- // the previous Task execution in this loop took longer
53- // than the scheduler's sweep interval. Most likely a subsequent
54- // Sweep call executed it already in another HTTP request.
53+ // Maybe a subsequent Sweep call or another machine in a webfarm executed
54+ // successive tasks already.
5555 // To be able to determine this, we need to reload the entity from the database.
5656 // The TaskExecutor will exit when the task should be in running state then.
5757 _services . DbContext . ReloadEntity ( task ) ;
You can’t perform that action at this time.
0 commit comments