Skip to content

Commit

Permalink
fix job result
Browse files Browse the repository at this point in the history
  • Loading branch information
ilvalerione committed Aug 27, 2019
1 parent 1dde295 commit 3421c56
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Providers/JobServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ public function boot()
}
});

/*$this->app['events']->listen(JobProcessed::class, function (JobProcessed $event) {
$this->handleJobEnd($event->job);
});*/
Queue::after(function (JobProcessed $event) {
$this->app['events']->listen(JobProcessed::class, function (JobProcessed $event) {
$this->handleJobEnd($event->job);
});

Expand Down Expand Up @@ -81,8 +78,7 @@ public function handleJobEnd(Job $job, $failed = false)
{
// If a segment doesn't exists it means that job is registered as transaction
// we can set the result accordingly
if (!array_key_exists($this->getJobId($job), $this->segments)) {
\Log::debug('Handle Job as transaction: '.($failed ? 'error' : 'success'));
if (!array_key_exists($this->getJobId($job), $this->segments) && $this->app['inspector']->isRecording()) {
$this->app['inspector']->currentTransaction()->setResult($failed ? 'error' : 'success');
} else {
$this->segments[$this->getJobId($job)]->end();
Expand Down

0 comments on commit 3421c56

Please sign in to comment.