File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -324,16 +324,18 @@ protected function _cleanup($groupId)
324
324
'system/cron/ ' . $ groupId . '/ ' . self ::XML_PATH_HISTORY_CLEANUP_EVERY ,
325
325
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
326
326
);
327
+
328
+ if ($ lastCleanup > time () - $ historyCleanUp * self ::SECONDS_IN_MINUTE ) {
329
+ return $ this ;
330
+ }
331
+
332
+ // check how long the record should stay unprocessed before marked as MISSED
327
333
$ scheduleLifetime = (int )$ this ->_scopeConfig ->getValue (
328
334
'system/cron/ ' . $ groupId . '/ ' . self ::XML_PATH_SCHEDULE_LIFETIME ,
329
335
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
330
336
);
331
337
$ scheduleLifetime = $ scheduleLifetime * self ::SECONDS_IN_MINUTE ;
332
338
333
- if ($ lastCleanup > time () - $ historyCleanUp * self ::SECONDS_IN_MINUTE ) {
334
- return $ this ;
335
- }
336
-
337
339
/**
338
340
* @var \Magento\Cron\Model\Resource\Schedule\Collection $history
339
341
*/
Original file line number Diff line number Diff line change @@ -576,9 +576,6 @@ public function testDispatchCleanup()
576
576
$ this ->_cache ->expects ($ this ->at (0 ))->method ('load ' )->will ($ this ->returnValue (time () + 10000000 ));
577
577
$ this ->_cache ->expects ($ this ->at (1 ))->method ('load ' )->will ($ this ->returnValue (time () - 10000000 ));
578
578
579
- //XML_PATH_HISTORY_CLEANUP_EVERY
580
- $ this ->_scopeConfig ->expects ($ this ->any ())->method ('getValue ' )->will ($ this ->returnValue (0 ));
581
- //XML_PATH_SCHEDULE_LIFETIME
582
579
$ this ->_scopeConfig ->expects ($ this ->any ())->method ('getValue ' )->will ($ this ->returnValue (0 ));
583
580
584
581
$ scheduleMock = $ this ->getMockBuilder ('Magento\Cron\Model\Schedule ' )->disableOriginalConstructor ()->getMock ();
@@ -633,8 +630,7 @@ public function testMissedJobsCleanedInTime()
633
630
$ schedule2 ->expects ($ this ->any ())->method ('getStatus ' )->will (
634
631
$ this ->returnValue (Schedule::STATUS_MISSED ));
635
632
//we don't expect this job be deleted from the list
636
- $ schedule2 ->expects ($ this ->never ())->method ('delete ' )->will (
637
- $ this ->returnValue (true ));
633
+ $ schedule2 ->expects ($ this ->never ())->method ('delete ' );
638
634
639
635
$ this ->_collection ->addItem ($ schedule1 );
640
636
$ this ->_config ->expects ($ this ->once ())->method ('getJobs ' )->will ($ this ->returnValue ($ jobConfig ));
@@ -683,6 +679,5 @@ public function testMissedJobsCleanedInTime()
683
679
$ this ->_scheduleFactory ->expects ($ this ->at (1 ))->method ('create ' )->will ($ this ->returnValue ($ scheduleMock ));
684
680
685
681
$ this ->_observer ->dispatch ('' );
686
-
687
682
}
688
683
}
You can’t perform that action at this time.
0 commit comments