Skip to content

Commit 8d9111c

Browse files
committed
fix: replace deprecated diffInRealMilliseconds with diffInUTCMilliseconds
Replace Carbon's deprecated diffInRealMilliseconds method with diffInUTCMilliseconds in RecordJobFailure and RecordJobSuccess listeners. The new method name is more explicit about converting both dates to UTC before comparison, ensuring accurate duration calculations regardless of timezone differences.
1 parent 6c82e91 commit 8d9111c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Listeners/RecordJobFailure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function handle(JobFailed $event): void
8989
$row->stack = Str::limit($event->exception->getTraceAsString(), 4000);
9090
$row->finished_at = now();
9191
if ($row->started_at) {
92-
$duration = $row->finished_at->diffInRealMilliseconds($row->started_at, true);
92+
$duration = $row->finished_at->diffInUTCMilliseconds($row->started_at, true);
9393
$row->duration_ms = max(0, (int) $duration);
9494
}
9595
// Telemetry end metrics

src/Listeners/RecordJobSuccess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function handle(JobProcessed $event): void
9393
$row->status = 'processed';
9494
$row->finished_at = now();
9595
if ($row->started_at) {
96-
$duration = $row->finished_at->diffInRealMilliseconds($row->started_at, true);
96+
$duration = $row->finished_at->diffInUTCMilliseconds($row->started_at, true);
9797
$row->duration_ms = max(0, (int) $duration);
9898
}
9999

0 commit comments

Comments
 (0)