Skip to content

Commit 59e299b

Browse files
committed
Fix container cannot bind parameters in the queue(#19)
1 parent 2df255c commit 59e299b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/ExceptionNotifyManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function report(Throwable $e)
7474
}
7575

7676
$this->registerException($e);
77-
$this->registerReportExceptionJobMethod();
7877
$this->dispatchReportExceptionJob();
7978
} catch (Throwable $e) {
8079
$this->container['log']->error($e->getMessage(), ['exception' => $e]);
@@ -100,9 +99,10 @@ function (ShouldQueue $job, Container $container) {
10099

101100
protected function dispatchReportExceptionJob()
102101
{
102+
$report = (string) $this->container->make(CollectorManager::class);
103103
$drivers = $this->getDrivers() ?: Arr::wrap($this->driver());
104104
foreach ($drivers as $driver) {
105-
$dispatch = dispatch(ReportExceptionJob::create($driver));
105+
$dispatch = dispatch(ReportExceptionJob::create($driver, $report));
106106

107107
'sync' === $this->container['config']['queue.default'] and
108108
method_exists($dispatch, 'afterResponse') and $dispatch->afterResponse();

src/Jobs/ReportExceptionJob.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,20 @@ class ReportExceptionJob implements ShouldQueue
5656
*/
5757
protected $channel;
5858

59-
public function __construct(Channel $channel)
59+
/**
60+
* @var string
61+
*/
62+
protected $report;
63+
64+
public function __construct(Channel $channel, string $report)
6065
{
6166
$this->channel = $channel;
67+
$this->report = $report;
6268
}
6369

64-
public function handle(string $report)
70+
public function handle()
6571
{
66-
$pipedReport = $this->pipelineReport($report);
72+
$pipedReport = $this->pipelineReport($this->report);
6773

6874
$this->fireReportingEvent($pipedReport);
6975
$result = $this->channel->report($pipedReport);

0 commit comments

Comments
 (0)