forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildScriptExecutor.php
More file actions
55 lines (45 loc) · 1.19 KB
/
BuildScriptExecutor.php
File metadata and controls
55 lines (45 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace ProcessMaker\Jobs;
use Illuminate\Bus\Queueable;
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
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
// These will be send with the payload
protected $lang;
protected $userId;
// Do not retry this job if it fails
public $tries = 20;
// Building can take some time
public $timeout = 600;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(string $lang, $userId)
{
$this->lang = $lang;
$this->userId = $userId;
}
/**
* Execute the job.
*
* @return void
*/
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)];
}
}