@@ -93,29 +93,14 @@ protected function getJobIdsByRanges(array $ranges)
93
93
protected function retryJob ($ job )
94
94
{
95
95
$ this ->laravel ['queue ' ]->connection ($ job ->connection )->pushRaw (
96
- $ this ->retryRefresh ( $ job ->payload ), $ job ->queue
96
+ $ this ->refreshRetryUntil ( $ this -> resetAttempts ( $ job ->payload ) ), $ job ->queue
97
97
);
98
98
}
99
99
100
- /**
101
- * Possibly refresh job attempts and retryUntil value.
102
- *
103
- * @param string $payload
104
- * @return string
105
- */
106
- protected function retryRefresh ($ payload )
107
- {
108
- $ payload = $ this ->resetAttempts ($ payload );
109
-
110
- $ payload = $ this ->refreshRetryUntil ($ payload );
111
-
112
- return $ payload ;
113
- }
114
-
115
100
/**
116
101
* Reset the payload attempts.
117
102
*
118
- * Applicable to Redis jobs which store attempts in their payload.
103
+ * Applicable to Redis and other jobs which store attempts in their payload.
119
104
*
120
105
* @param string $payload
121
106
* @return string
@@ -132,7 +117,7 @@ protected function resetAttempts($payload)
132
117
}
133
118
134
119
/**
135
- * Refreshes a jobs retryUntil time with it's own retryUntil method .
120
+ * Refresh the "retry until" timestamp for the job .
136
121
*
137
122
* @param string $payload
138
123
* @return string
@@ -141,12 +126,10 @@ protected function refreshRetryUntil($payload)
141
126
{
142
127
$ payload = json_decode ($ payload , true );
143
128
144
- $ jobInstance = unserialize ($ payload ['data ' ]['command ' ]);
145
-
146
- if (method_exists ($ jobInstance , 'retryUntil ' )) {
147
- $ newRetryUntil = $ jobInstance ->retryUntil ()->timestamp ;
129
+ $ instance = unserialize ($ payload ['data ' ]['command ' ]);
148
130
149
- $ payload ['retryUntil ' ] = $ newRetryUntil ;
131
+ if (is_object ($ instance ) && method_exists ($ instance , 'retryUntil ' )) {
132
+ $ payload ['retryUntil ' ] = $ instance ->retryUntil ()->timestamp ;
150
133
}
151
134
152
135
return json_encode ($ payload );
0 commit comments