1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dtc\QueueBundle\Model; |
4
|
|
|
|
5
|
|
|
abstract class RetryableJob extends \Dtc\QueueBundle\Model\Job |
6
|
|
|
{ |
7
|
|
|
const STATUS_MAX_ERROR = 'max_error'; |
8
|
|
|
const STATUS_MAX_STALLED = 'max_stallled'; |
9
|
|
|
const STATUS_MAX_RETRIES = 'max_retries'; |
10
|
|
|
|
11
|
|
|
protected $maxStalled; |
12
|
|
|
protected $stalledCount = 0; |
13
|
|
|
protected $maxError; |
14
|
|
|
protected $errorCount = 0; |
15
|
|
|
protected $maxRetries; |
16
|
|
|
protected $retries = 0; |
17
|
|
|
protected $createdAt; |
18
|
|
|
protected $updatedAt; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @return int|null |
22
|
|
|
*/ |
23
|
25 |
|
public function getMaxStalled() |
24
|
|
|
{ |
25
|
25 |
|
return $this->maxStalled; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param int|null $maxStalled |
30
|
|
|
* |
31
|
|
|
* @return RetryableJob |
32
|
|
|
*/ |
33
|
4 |
|
public function setMaxStalled($maxStalled) |
34
|
|
|
{ |
35
|
4 |
|
$this->maxStalled = $maxStalled; |
36
|
|
|
|
37
|
4 |
|
return $this; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @return int |
42
|
|
|
*/ |
43
|
25 |
|
public function getStalledCount() |
44
|
|
|
{ |
45
|
25 |
|
return $this->stalledCount; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param int $stalledCount |
50
|
|
|
* |
51
|
|
|
* @return RetryableJob |
52
|
|
|
*/ |
53
|
25 |
|
public function setStalledCount($stalledCount) |
54
|
|
|
{ |
55
|
25 |
|
$this->stalledCount = $stalledCount; |
56
|
|
|
|
57
|
25 |
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return int|null |
62
|
|
|
*/ |
63
|
25 |
|
public function getMaxError() |
64
|
|
|
{ |
65
|
25 |
|
return $this->maxError; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param int|null $maxError |
70
|
|
|
* |
71
|
|
|
* @return RetryableJob |
72
|
|
|
*/ |
73
|
4 |
|
public function setMaxError($maxError) |
74
|
|
|
{ |
75
|
4 |
|
$this->maxError = $maxError; |
76
|
|
|
|
77
|
4 |
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return int |
82
|
|
|
*/ |
83
|
25 |
|
public function getErrorCount() |
84
|
|
|
{ |
85
|
25 |
|
return $this->errorCount; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param int $errorCount |
90
|
|
|
* |
91
|
|
|
* @return RetryableJob |
92
|
|
|
*/ |
93
|
25 |
|
public function setErrorCount($errorCount) |
94
|
|
|
{ |
95
|
25 |
|
$this->errorCount = $errorCount; |
96
|
|
|
|
97
|
25 |
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return int |
102
|
|
|
*/ |
103
|
25 |
|
public function getRetries() |
104
|
|
|
{ |
105
|
25 |
|
return $this->retries; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param int $retries |
110
|
|
|
* |
111
|
|
|
* @return RetryableJob |
112
|
|
|
*/ |
113
|
25 |
|
public function setRetries($retries) |
114
|
|
|
{ |
115
|
25 |
|
$this->retries = $retries; |
116
|
|
|
|
117
|
25 |
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return int|null |
122
|
|
|
*/ |
123
|
25 |
|
public function getMaxRetries() |
124
|
|
|
{ |
125
|
25 |
|
return $this->maxRetries; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param int|null $maxRetries |
130
|
|
|
* |
131
|
|
|
* @return RetryableJob |
132
|
|
|
*/ |
133
|
4 |
|
public function setMaxRetries($maxRetries) |
134
|
|
|
{ |
135
|
4 |
|
$this->maxRetries = $maxRetries; |
136
|
|
|
|
137
|
4 |
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return \DateTime |
142
|
|
|
*/ |
143
|
27 |
|
public function getCreatedAt() |
144
|
|
|
{ |
145
|
27 |
|
return $this->createdAt; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return \DateTime |
150
|
|
|
*/ |
151
|
21 |
|
public function getUpdatedAt() |
152
|
|
|
{ |
153
|
21 |
|
return $this->updatedAt; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param \DateTime $createdAt |
158
|
|
|
*/ |
159
|
27 |
|
public function setCreatedAt(\DateTime $createdAt) |
160
|
|
|
{ |
161
|
27 |
|
$this->createdAt = $createdAt; |
162
|
|
|
|
163
|
27 |
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param \DateTime $updatedAt |
168
|
|
|
*/ |
169
|
27 |
|
public function setUpdatedAt(\DateTime $updatedAt) |
170
|
|
|
{ |
171
|
27 |
|
$this->updatedAt = $updatedAt; |
172
|
27 |
|
} |
173
|
|
|
} |
174
|
|
|
|