refactor: enhance ApplicationDeploymentJob and HorizonServiceProvider for improved job handling

- Removed the private property for application deployment queue ID in ApplicationDeploymentJob and utilized constructor property promotion.
- Added a tags method in ApplicationDeploymentJob to properly identify the worker running the job.
- Updated HorizonServiceProvider to handle cases where the deployment queue ID is blank, preventing potential errors during job processing.
- Cleaned up the isAnyDeploymentInprogress function by removing unnecessary whitespace.
This commit is contained in:
Andras Bacsai
2025-01-10 20:07:01 +01:00
parent 7582d7dd8b
commit 3a3219394d
3 changed files with 11 additions and 6 deletions

View File

@@ -38,6 +38,9 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
$deploymentQueueId = collect($tags)->first(function ($tag) {
return str_contains($tag, 'App\Models\ApplicationDeploymentQueue');
});
if (blank($deploymentQueueId)) {
return;
}
$deploymentQueueId = explode(':', $deploymentQueueId)[1];
$deploymentQueue = ApplicationDeploymentQueue::find($deploymentQueueId);
$deploymentQueue->update([