@@ -613,7 +613,7 @@ public function requestJob(array $tasks, array $groups = [], array $types = []):
613613
614614 break ;
615615 case static ::DRIVER_SQLITE :
616- //TODO
616+ $ tmp [ ' strftime("%s", "now") >= ' ] = $ this -> rateHistory [ $ tmp [ ' job_task ' ]] + $ task [ ' rate ' ];
617617
618618 break ;
619619 }
@@ -632,8 +632,10 @@ public function requestJob(array $tasks, array $groups = [], array $types = []):
632632
633633 break ;
634634 case static ::DRIVER_SQLSERVER :
635- // the ORM does not support ROW locking at the moment
636- // TODO
635+ // Row-level locking (ROWLOCK, UPDLOCK hints) not supported by CakePHP ORM.
636+ // SQLServer uses default isolation level (READ COMMITTED) with automatic
637+ // row locking on UPDATE. This may allow race conditions in high-concurrency
638+ // scenarios. Consider using application-level locking or advisory locks if needed.
637639
638640 break ;
639641 case static ::DRIVER_SQLITE :
@@ -925,8 +927,10 @@ public function cleanOldJobs(): int {
925927 return 0 ;
926928 }
927929
930+ $ threshold = (new DateTime ())->subSeconds ((int )Configure::read ('Queue.cleanuptimeout ' ));
931+
928932 return $ this ->deleteAll ([
929- 'completed < ' => time () - ( int )Configure:: read ( ' Queue.cleanuptimeout ' ) ,
933+ 'completed < ' => $ threshold ,
930934 ]);
931935 }
932936
@@ -979,7 +983,7 @@ public function key(): string {
979983 if ($ this ->_key !== null ) {
980984 return $ this ->_key ;
981985 }
982- $ this ->_key = sha1 ( microtime () . mt_rand ( 100 , 999 ));
986+ $ this ->_key = bin2hex ( random_bytes ( 20 ));
983987 if (!$ this ->_key ) {
984988 throw new RuntimeException ('Invalid key generated ' );
985989 }
0 commit comments