Skip to content

Commit

Permalink
Store Job ID
Browse files Browse the repository at this point in the history
  • Loading branch information
imTigger committed Jul 18, 2017
1 parent 9e0fb98 commit 9c3906e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/LaravelJobStatusServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Queue\QueueManager;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\ServiceProvider;
use Log;

class LaravelJobStatusServiceProvider extends ServiceProvider
{
Expand All @@ -22,6 +22,7 @@ public function boot()
app(QueueManager::class)->before(function (JobProcessing $event) {
$this->updateJobStatus($event->job, [
'status' => 'executing',
'job_id' => $event->job->getJobId(),
'attempts' => $event->job->attempts(),
'queue' => $event->job->getQueue(),
'started_at' => Carbon::now()
Expand Down Expand Up @@ -60,7 +61,7 @@ private function updateJobStatus(Job $job, array $data)
if (!is_callable([$jobStatus, 'getJobStatusId'])) {
return;
}

$jobStatusId = $jobStatus->getJobStatusId();

$jobStatus = JobStatus::where('id', '=', $jobStatusId);
Expand Down

0 comments on commit 9c3906e

Please sign in to comment.