mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
@@ -26,7 +26,7 @@ class BackgroundTaskManager extends Emitter {
|
|||||||
return this.tasks.size;
|
return this.tasks.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
async newTask(type, opts) {
|
async newTask(type, opts, sticky = false) {
|
||||||
this.logger.info({opts}, `initiating Background task ${type}`);
|
this.logger.info({opts}, `initiating Background task ${type}`);
|
||||||
if (this.tasks.has(type)) {
|
if (this.tasks.has(type)) {
|
||||||
this.logger.info(`Background task ${type} is running, skipped`);
|
this.logger.info(`Background task ${type} is running, skipped`);
|
||||||
@@ -52,6 +52,7 @@ class BackgroundTaskManager extends Emitter {
|
|||||||
if (task) {
|
if (task) {
|
||||||
this.tasks.set(type, task);
|
this.tasks.set(type, task);
|
||||||
}
|
}
|
||||||
|
if (task && sticky) task.sticky = true;
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +117,7 @@ class BackgroundTaskManager extends Emitter {
|
|||||||
this._taskCompleted('bargeIn', task);
|
this._taskCompleted('bargeIn', task);
|
||||||
if (task.sticky && !this.cs.callGone && !this.cs._stopping) {
|
if (task.sticky && !this.cs.callGone && !this.cs._stopping) {
|
||||||
this.logger.info('BackgroundTaskManager:_initBargeIn: restarting background bargeIn');
|
this.logger.info('BackgroundTaskManager:_initBargeIn: restarting background bargeIn');
|
||||||
this.newTask('bargeIn', opts);
|
this.newTask('bargeIn', opts, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user