diff --git a/src/Providers/JobServiceProvider.php b/src/Providers/JobServiceProvider.php index fd08778..3e68067 100644 --- a/src/Providers/JobServiceProvider.php +++ b/src/Providers/JobServiceProvider.php @@ -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); }); @@ -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();