[BUGFIX] Execute scheduler tasks ordered by next execution time 90/58790/5
authorSascha Egerer <sascha@sascha-egerer.de>
Tue, 30 Oct 2018 09:52:04 +0000 (10:52 +0100)
committerBenni Mack <benni@typo3.org>
Tue, 30 Oct 2018 21:11:09 +0000 (22:11 +0100)
When executing scheduler tasks the next execution time of the task
should be used to define the execution order.

Resolves: #86795
Releases: master, 8.7
Change-Id: Id678c74a60491aa3c8be8a33534b71ac37245217
Reviewed-on: https://review.typo3.org/58790
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/scheduler/Classes/Scheduler.php

index 2905bce..460ad08 100644 (file)
@@ -325,6 +325,7 @@ class Scheduler implements SingletonInterface, LoggerAwareInterface
                 ),
                 $queryBuilder->expr()->eq('t.deleted', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT))
             );
+            $queryBuilder->orderBy('t.nextexecution', 'ASC');
         } else {
             $queryBuilder->where(
                 $queryBuilder->expr()->eq('t.uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)),