Skip to content

Commit 7cd461d

Browse files
Update CronMonitorListener to track and reuse check-in IDs
1 parent 7f69f4e commit 7cd461d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/EventListener/CronMonitorListener.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ class CronMonitorListener
2323
*/
2424
private $registeredCommands;
2525

26+
/**
27+
* @var string|null
28+
*/
29+
private $checkinId;
30+
2631
/**
2732
* @param HubInterface $hub
2833
* @param array<string> $registeredCommands
@@ -41,7 +46,7 @@ public function handleConsoleCommandEvent(ConsoleCommandEvent $event): void
4146
return;
4247
}
4348

44-
$checkinId = $this->hub->captureCheckIn(
49+
$this->checkinId = $this->hub->captureCheckIn(
4550
$this->registeredCommands[$this->getCommandIndex($command)],
4651
CheckInStatus::inProgress()
4752
);
@@ -59,7 +64,10 @@ public function handleConsoleTerminateEvent(ConsoleTerminateEvent $event): void
5964
$this->registeredCommands[$this->getCommandIndex($command)],
6065
Command::SUCCESS === $event->getExitCode()
6166
? CheckInStatus::ok()
62-
: CheckInStatus::error()
67+
: CheckInStatus::error(),
68+
null,
69+
null,
70+
$this->checkinId
6371
);
6472
}
6573

@@ -73,7 +81,10 @@ public function handleConsoleErrorEvent(ConsoleErrorEvent $event): void
7381

7482
$this->hub->captureCheckIn(
7583
$this->registeredCommands[$this->getCommandIndex($command)],
76-
CheckInStatus::error()
84+
CheckInStatus::error(),
85+
null,
86+
null,
87+
$this->checkinId
7788
);
7889
}
7990

0 commit comments

Comments
 (0)