From f0de89b0e8a546870d3cfe746908e897e6fa6687 Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Thu, 9 Jul 2026 23:34:26 +0200 Subject: [PATCH] Prevent failed jobs for no longer existing projects and tasks --- app/Jobs/RecalculateSpentTimeForProject.php | 5 +++++ app/Jobs/RecalculateSpentTimeForTask.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/Jobs/RecalculateSpentTimeForProject.php b/app/Jobs/RecalculateSpentTimeForProject.php index 024e19d6..6ad375ce 100644 --- a/app/Jobs/RecalculateSpentTimeForProject.php +++ b/app/Jobs/RecalculateSpentTimeForProject.php @@ -20,6 +20,11 @@ class RecalculateSpentTimeForProject implements ShouldDispatchAfterCommit, Shoul use Queueable; use SerializesModels; + /** + * Delete the job if its models no longer exist. + */ + public bool $deleteWhenMissingModels = true; + public Project $project; /** diff --git a/app/Jobs/RecalculateSpentTimeForTask.php b/app/Jobs/RecalculateSpentTimeForTask.php index 5f04dc6e..649bc8e9 100644 --- a/app/Jobs/RecalculateSpentTimeForTask.php +++ b/app/Jobs/RecalculateSpentTimeForTask.php @@ -20,6 +20,11 @@ class RecalculateSpentTimeForTask implements ShouldDispatchAfterCommit, ShouldQu use Queueable; use SerializesModels; + /** + * Delete the job if its models no longer exist. + */ + public bool $deleteWhenMissingModels = true; + public Task $task; /**