@@ -269,30 +269,37 @@ protected function scheduleJob(ScheduledJob $job): void
269269 job = :job,
270270 claimed = :claimed
271271 MySQL ;
272- $ this ->dbal
273- ->executeQuery (
274- $ statement ,
275- [
276- 'groupname ' => $ job ->getGroupName (),
277- 'identifier ' => $ job ->getIdentifier (),
278- 'duedate ' => $ job ->getDuedate (),
279- 'queue ' => $ job ->getQueueName (),
280- 'job ' => serialize ($ job ->getJob ()),
281- 'incarnation ' => $ job ->getIncarnation (),
282- 'claimed ' => $ job ->getClaimed (),
283- 'running ' => $ job ->isRunning () ? 1 : 0 ,
284- ],
285- [
286- 'groupname ' => Types::STRING ,
287- 'identifier ' => Types::STRING ,
288- 'duedate ' => Types::DATETIME_IMMUTABLE ,
289- 'queue ' => Types::STRING ,
290- 'job ' => Types::BLOB ,
291- 'incarnation ' => Types::INTEGER ,
292- 'claimed ' => Types::STRING ,
293- 'running ' => Types::BOOLEAN ,
294- ]
295- );
272+
273+ (new Retry ())
274+ /**
275+ * @see http://backoffcalculator.com/?attempts=5&rate=1&interval=0.1
276+ */
277+ ->withExponentialBackoff (retryInterval: 0.05 , maxRetries: 5 )
278+ ->onExceptionsOfType (RetryableException::class)
279+ ->task (fn () => $ this ->dbal
280+ ->executeQuery (
281+ $ statement ,
282+ [
283+ 'groupname ' => $ job ->getGroupName (),
284+ 'identifier ' => $ job ->getIdentifier (),
285+ 'duedate ' => $ job ->getDuedate (),
286+ 'queue ' => $ job ->getQueueName (),
287+ 'job ' => serialize ($ job ->getJob ()),
288+ 'incarnation ' => $ job ->getIncarnation (),
289+ 'claimed ' => $ job ->getClaimed (),
290+ 'running ' => $ job ->isRunning () ? 1 : 0 ,
291+ ],
292+ [
293+ 'groupname ' => Types::STRING ,
294+ 'identifier ' => Types::STRING ,
295+ 'duedate ' => Types::DATETIME_IMMUTABLE ,
296+ 'queue ' => Types::STRING ,
297+ 'job ' => Types::BLOB ,
298+ 'incarnation ' => Types::INTEGER ,
299+ 'claimed ' => Types::STRING ,
300+ 'running ' => Types::BOOLEAN ,
301+ ]
302+ ));
296303 // TODO: Find a way to "trigger queueing" without cronjobs. Maybe "dynamic cronjobs" like "at".
297304 // TODO: On Shutdown: Add queueing job to job queue.
298305 }
0 commit comments