diff --git a/ProcessMaker/Jobs/BuildScriptExecutor.php b/ProcessMaker/Jobs/BuildScriptExecutor.php index f83ee67703..ad09d207c2 100644 --- a/ProcessMaker/Jobs/BuildScriptExecutor.php +++ b/ProcessMaker/Jobs/BuildScriptExecutor.php @@ -6,6 +6,7 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\SerializesModels; class BuildScriptExecutor implements ShouldQueue @@ -18,7 +19,7 @@ class BuildScriptExecutor implements ShouldQueue protected $userId; // Do not retry this job if it fails - public $tries = 1; + public $tries = 20; // Building can take some time public $timeout = 600; @@ -43,4 +44,12 @@ public function handle() { \Artisan::call('processmaker:build-script-executor ' . $this->lang . ' ' . $this->userId . ' --rebuild'); } + + /** + * Prevent job overlaps + */ + public function middleware(): array + { + return [(new WithoutOverlapping())->releaseAfter(10)]; + } }