Skip to content

Commit

Permalink
Fix for thread stealing
Browse files Browse the repository at this point in the history
  • Loading branch information
Simbiat committed Apr 26, 2021
1 parent 71ab374 commit 52dbea5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function process(int $items = 1): bool
#Check if enough threads are available
if ($this->threadAvailable() === true) {
#Queue tasks for this random ID
if (self::$dbController->query('UPDATE `'.self::$prefix.'schedule` SET `status`=1, `runby`=\''.$randomid.'\' WHERE `status`<>2 AND `nextrun`<=UTC_TIMESTAMP() ORDER BY `priority` DESC, `nextrun` ASC LIMIT '.$items) !== true) {
if (self::$dbController->query('UPDATE `'.self::$prefix.'schedule` SET `status`=1, `runby`=\''.$randomid.'\' WHERE `status`<>2 AND `runby` IS NULL AND `nextrun`<=UTC_TIMESTAMP() ORDER BY `priority` DESC, `nextrun` ASC LIMIT '.$items) !== true) {
#Notify of end of stream
if (self::$CLI === false) {
$this->streamEcho('Cron processing failed', 'CronFail');
Expand Down

0 comments on commit 52dbea5

Please sign in to comment.