mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-15 14:16:28 +00:00
Merge remote-tracking branch 'origin/next' into api-sensitive-data-scrubber
This commit is contained in:
commit
ea0ade442b
2 files changed
+88
No files matched your search
@@ -3,9 +3,12 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Contracts\CustomJobRepositoryInterface;
|
||||
use App\Exceptions\DeploymentException;
|
||||
use App\Models\ApplicationDeploymentQueue;
|
||||
use App\Models\User;
|
||||
use App\Repositories\CustomJobRepository;
|
||||
use Illuminate\Queue\Events\JobFailed;
|
||||
use Illuminate\Queue\TimeoutExceededException;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Horizon\Contracts\JobRepository;
|
||||
@@ -48,6 +51,26 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
Event::listen(function (JobFailed $event) {
|
||||
if (! isCloud()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$exception = $event->exception;
|
||||
if (! ($exception instanceof DeploymentException) && ! ($exception instanceof TimeoutExceededException)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$uuid = $event->job->uuid();
|
||||
if ($uuid) {
|
||||
app(JobRepository::class)->deleteFailed($uuid);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// Best-effort scrub; never mask the original failure.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function gate(): void
|
||||
|
||||
Reference in new issue
Block a user