Skip to content

Commit 7418d93

Browse files
authored
Add the ability to select job codes using regex (#197)
1 parent 8667890 commit 7418d93

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Model/SentryCron.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ public function sendScheduleStatus(Schedule $schedule)
3737
{
3838
if (!$this->data->isActive() ||
3939
!$this->data->isCronMonitoringEnabled() ||
40-
!in_array(
41-
$schedule->getJobCode(),
42-
$this->data->getTrackCrons()
40+
!array_reduce(
41+
$this->data->getTrackCrons(),
42+
fn ($trackCron, $expression) => $trackCron || (
43+
preg_match('/^\/.*\/[imsu]*$/', $expression) ?
44+
preg_match($expression, $schedule->getJobCode()) :
45+
$schedule->getJobCode() === $expression
46+
),
47+
false
4348
)
4449
) {
4550
return;

0 commit comments

Comments
 (0)