@@ -208,7 +208,7 @@ public function runworker(): void
208208 }
209209 if ($ this ->_exit || mt_rand (0 , 100 ) > (100 - Config::gcprob ())) {
210210 $ this ->out (__d ('queue ' , 'Performing old job cleanup. ' ));
211- $ this ->QueuedTasks ->cleanOldJobs ();
211+ $ this ->QueuedTasks ->cleanOldJobs ($ this -> _getTaskConf () );
212212 }
213213 $ this ->hr ();
214214 }
@@ -276,12 +276,20 @@ protected function runJob(QueuedTask $queuedTask): void
276276 */
277277 public function clean (): void
278278 {
279- if (!Configure:: read ( ' Queue.cleanupTimeout ' )) {
280- $ this ->abort ( ' You disabled cleanuptimout in config. Aborting. ' );
281- }
279+ $ this -> out ( __d ( ' queue ' , ' Deleting old completed jobs, that have had cleanup timeout. ' ));
280+ $ this ->QueuedTasks -> cleanOldJobs ( $ this -> _getTaskConf () );
281+ }
282282
283- $ this ->out ('Deleting old jobs, that have finished before ' . date ('Y-m-d H:i:s ' , time () - (int )Configure::read ('Queue.cleanupTimeout ' )));
284- $ this ->QueuedTasks ->cleanOldJobs ();
283+ /**
284+ * Manually trigger a Failed job cleanup.
285+ *
286+ * @return void
287+ */
288+ //@codingStandardsIgnoreLine
289+ public function clean_failed (): void
290+ {
291+ $ this ->out (__d ('queue ' , 'Deleting failed jobs, that have had maximum worker retries. ' ));
292+ $ this ->QueuedTasks ->cleanFailedJobs ($ this ->_getTaskConf ());
285293 }
286294
287295 /**
@@ -363,6 +371,10 @@ public function getOptionParser(): ConsoleOptionParser
363371 'help ' => 'Remove old jobs (cleanup) ' ,
364372 'parser ' => $ subcommandParser
365373 ])
374+ ->addSubcommand ('clean_failed ' , [
375+ 'help ' => 'Remove old failed jobs (cleanup) ' ,
376+ 'parser ' => $ subcommandParser
377+ ])
366378 ->addSubcommand ('add ' , [
367379 'help ' => 'Add Job ' ,
368380 'parser ' => $ subcommandParser
0 commit comments