Skip to content

Commit 67334f0

Browse files
committed
feat(interval): Allow tasks to be setup that don't fire on interval (for use with IPC)
1 parent 59fce12 commit 67334f0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

classes/BackgroundTasks.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,20 @@ var BackgroundTasks = Class.extend(
108108
},
109109

110110
runTaskWorkers: function( taskName ) {
111-
debug( 'Running '+ taskName + '...' );
112111
async.each(
113112
Object.keys( this.workers[ taskName ] ),
114113
this.proxy( 'runTaskOnWorker', taskName )
115114
);
116115
},
117116

118117
runTaskOnWorker: function( taskName, pid ) {
119-
var worker = this.workers[ taskName ][ pid ];
120-
if ( !!worker.ready && !worker.busy ) {
121-
worker.send( { payload: null } );
118+
if ( this.workers[ taskName ][ pid ].task.interval !== false ) {
119+
debug( 'Running '+ taskName + '...' );
120+
121+
var worker = this.workers[ taskName ][ pid ];
122+
if ( !!worker.ready && !worker.busy ) {
123+
worker.send( { payload: null } );
124+
}
122125
}
123126
},
124127

0 commit comments

Comments
 (0)