File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -159,32 +159,33 @@ Worker.prototype.process = function (job, fn) {
159
159
// process.nextTick( function(){
160
160
fn (
161
161
job ,
162
- /**
163
- * @author behrad
164
- * @pause : let the processor to tell worker not to continue processing new jobs
165
- */
166
- function ( err , pause ) {
162
+ function ( err ) {
167
163
if ( err ) {
168
164
return self . failed ( job , err , fn ) ;
169
165
}
170
166
job . complete ( ) ;
171
167
job . set ( 'duration' , job . duration = new Date - start ) ;
172
168
self . emit ( 'job complete' , job ) ;
173
169
events . emit ( job . id , 'complete' ) ;
174
- if ( pause ) {
175
- self . queue . shutdown ( function ( ) {
176
- } , pause === true ?5000 :Number ( pause ) , self . type ) ;
177
- }
178
170
self . job = null ;
179
171
self . start ( fn ) ;
180
- } ,
181
- /**
182
- * @author behrad
183
- * @pause : let the processor to trigger restart for they job processing
184
- */
185
- function ( ) {
186
- if ( self . resume ( ) ) {
187
- self . start ( fn ) ;
172
+ } , {
173
+ /**
174
+ * @author behrad
175
+ * @pause : let the processor to tell worker not to continue processing new jobs
176
+ */
177
+ pause : function ( fn , timeout ) {
178
+ timeout = timeout || 5000 ;
179
+ self . queue . shutdown ( fn , Number ( timeout ) , self . type ) ;
180
+ } ,
181
+ /**
182
+ * @author behrad
183
+ * @pause : let the processor to trigger restart for they job processing
184
+ */
185
+ resume : function ( ) {
186
+ if ( self . resume ( ) ) {
187
+ self . start ( fn ) ;
188
+ }
188
189
}
189
190
}
190
191
) ;
You can’t perform that action at this time.
0 commit comments