-
Notifications
You must be signed in to change notification settings - Fork 52
/
WorkerOptions.php
125 lines (112 loc) · 2.43 KB
/
WorkerOptions.php
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
namespace Illuminate\Queue;
class WorkerOptions
{
/**
* The name of the worker.
*
* @var string
*/
public $name;
/**
* The number of seconds to wait before retrying a job that encountered an uncaught exception.
*
* @var int|int[]
*/
public $backoff;
/**
* The maximum amount of RAM the worker may consume.
*
* @var int
*/
public $memory;
/**
* The maximum number of seconds a child worker may run.
*
* @var int
*/
public $timeout;
/**
* The number of seconds to wait in between polling the queue.
*
* @var int
*/
public $sleep;
/**
* The number of seconds to rest between jobs.
*
* @var int
*/
public $rest;
/**
* The maximum number of times a job may be attempted.
*
* @var int
*/
public $maxTries;
/**
* Indicates if the worker should run in maintenance mode.
*
* @var bool
*/
public $force;
/**
* Indicates if the worker should stop when the queue is empty.
*
* @var bool
*/
public $stopWhenEmpty;
/**
* The maximum number of jobs to run.
*
* @var int
*/
public $maxJobs;
/**
* The maximum number of seconds a worker may live.
*
* @var int
*/
public $maxTime;
/**
* Create a new worker options instance.
*
* @param string $name
* @param int|int[] $backoff
* @param int $memory
* @param int $timeout
* @param int $sleep
* @param int $maxTries
* @param bool $force
* @param bool $stopWhenEmpty
* @param int $maxJobs
* @param int $maxTime
* @param int $rest
* @return void
*/
public function __construct(
$name = 'default',
$backoff = 0,
$memory = 128,
$timeout = 60,
$sleep = 3,
$maxTries = 1,
$force = false,
$stopWhenEmpty = false,
$maxJobs = 0,
$maxTime = 0,
$rest = 0,
) {
$this->name = $name;
$this->backoff = $backoff;
$this->sleep = $sleep;
$this->rest = $rest;
$this->force = $force;
$this->memory = $memory;
$this->timeout = $timeout;
$this->maxTries = $maxTries;
$this->stopWhenEmpty = $stopWhenEmpty;
$this->maxJobs = $maxJobs;
$this->maxTime = $maxTime;
}
}