Skip to content

Commit

Permalink
Update Job_Queue.php
Browse files Browse the repository at this point in the history
  • Loading branch information
n0nag0n authored May 5, 2024
1 parent 332c558 commit 6029357
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Job_Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ public function addJob(string $payload, int $delay = 0, int $priority = 1024, in
case self::QUEUE_TYPE_SQLITE:
$table_name = $this->getSqlTableName();
$field_value = $this->isMysqlQueueType() && $this->options['mysql']['use_compression'] === true ? 'COMPRESS(?)' : '?';
$delay_date_time = gmdate('Y-m-d H:i:s', strtotime('now +'.$delay.' seconds UTC'));
$delay_date_time = gmdate('Y-m-d H:i:s', strtotime('now +'.$delay.' seconds'));
$added_dt = gmdate('Y-m-d H:i:s');
$time_to_retry_dt = gmdate('Y-m-d H:i:s', strtotime('now +'.$time_to_retry.' seconds UTC'));
$time_to_retry_dt = gmdate('Y-m-d H:i:s', strtotime('now +'.$time_to_retry.' seconds'));
$statement = $this->connection->prepare("INSERT INTO {$table_name} (pipeline, payload, added_dt, send_dt, priority, is_reserved, reserved_dt, is_buried, attempts, time_to_retry_dt) VALUES (?, {$field_value}, ?, ?, ?, 0, NULL, 0, 0, ?)");
$statement->execute([
$this->pipeline,
Expand Down Expand Up @@ -254,7 +254,7 @@ public function getNextJobAndReserve() {
$table_name = $this->getSqlTableName();
$field = $this->isMysqlQueueType() && $this->options['mysql']['use_compression'] === true ? 'UNCOMPRESS(payload) payload' : 'payload';
$send_dt = gmdate('Y-m-d H:i:s');
$reserved_dt = gmdate('Y-m-d H:i:s', strtotime('now -5 minutes UTC'));
$reserved_dt = gmdate('Y-m-d H:i:s', strtotime('now -5 minutes'));
$statement = $this->connection->prepare("SELECT id, {$field}, added_dt, send_dt, priority, is_reserved, reserved_dt, is_buried, buried_dt
FROM {$table_name}
WHERE pipeline = ? AND send_dt <= ? AND is_buried = 0 AND (is_reserved = 0 OR (is_reserved = 1 AND reserved_dt <= ? ) ) AND (attempts = 0 OR (attempts >= 1 AND time_to_retry_dt <= ?) )
Expand Down Expand Up @@ -296,7 +296,7 @@ public function getNextBuriedJob() {
$table_name = $this->getSqlTableName();
$field = $this->isMysqlQueueType() && $this->options['mysql']['use_compression'] === true ? 'UNCOMPRESS(payload) payload' : 'payload';
$send_dt = gmdate('Y-m-d H:i:s');
$reserved_dt = gmdate('Y-m-d H:i:s', strtotime('now -5 minutes UTC'));
$reserved_dt = gmdate('Y-m-d H:i:s', strtotime('now -5 minutes'));
$statement = $this->connection->prepare("SELECT id, {$field}, added_dt, send_dt, priority, is_reserved, reserved_dt, is_buried, buried_dt
FROM {$table_name}
WHERE pipeline = ? AND send_dt <= ? AND is_buried = 1
Expand Down

0 comments on commit 6029357

Please sign in to comment.