Skip to content

Commit

Permalink
fix: set created at before Job::__constructor() so it isn't overwritten.
Browse files Browse the repository at this point in the history
build: [release]
  • Loading branch information
lots0logs committed Dec 10, 2024
1 parent 18120c8 commit fe5188e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ class Job extends Base implements JsonSerializable {
public string $status;

public function __construct( string $id, array $details = [] ) {
$this->callbacks = $details['callbacks'];
$this->data = $details['data'];
$this->id = $details['id'];
$this->queue = $details['queue'];
$this->status = $details['status'];

$this->created_at = time();
$this->callbacks = $details['callbacks'];
$this->data = $details['data'];
$this->id = $details['id'];
$this->queue = $details['queue'];
$this->status = $details['status'];
$this->created_at = $details['created_at'];
}

public static function instance( string $queue, ?string $id, ?array $details = null ): self {
Expand All @@ -44,8 +43,9 @@ public static function instance( string $queue, ?string $id, ?array $details = n
// Create new job in database
$id = $details['id'] = self::_uuid4();

$details['status'] = 'pending';
$details['queue'] = $queue;
$details['status'] = 'pending';
$details['queue'] = $queue;
$details['created_at'] = time();

self::_dbTry( 'set', self::_key( 'queues', $queue, 'jobs', $id ), json_encode( $details ) );

Expand Down

0 comments on commit fe5188e

Please sign in to comment.