Skip to content

Commit

Permalink
Fix the bug that cannot match FailToExecute (#414)
Browse files Browse the repository at this point in the history
Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia authored Nov 9, 2023
1 parent e20e911 commit a387a81
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sentry/src/Tracing/Listener/TracingCrontabListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public function __construct(
public function listen(): array
{
return [
BeforeExecute::class, // @phpstan-ignore-line
BeforeExecute::class,
FailToExecute::class,
AfterExecute::class, // @phpstan-ignore-line
AfterExecute::class,
];
}

Expand All @@ -47,12 +47,12 @@ public function listen(): array
public function process(object $event): void
{
match ($event::class) {
BeforeExecute::class => $this->startTransaction($event), // @phpstan-ignore-line
AfterExecute::class => $this->finishTransaction($event), // @phpstan-ignore-line
BeforeExecute::class => $this->startTransaction($event),
AfterExecute::class, FailToExecute::class => $this->finishTransaction($event),
};
}

protected function startTransaction(BeforeExecute $event): void // @phpstan-ignore-line
protected function startTransaction(BeforeExecute $event): void
{
$sentry = SentrySdk::init();
/** @var Crontab $crontab */
Expand Down Expand Up @@ -93,7 +93,7 @@ protected function startTransaction(BeforeExecute $event): void // @phpstan-igno
TraceContext::setSpan($transaction);
}

protected function finishTransaction(AfterExecute|FailToExecute $event): void // @phpstan-ignore-line
protected function finishTransaction(AfterExecute|FailToExecute $event): void
{
$transaction = TraceContext::getTransaction();

Expand Down

0 comments on commit a387a81

Please sign in to comment.