This commit is contained in:
Dave Horton
2024-04-10 16:15:28 -04:00
parent 4a52be9171
commit b93bfbb486

View File

@@ -26,7 +26,7 @@ class BackgroundTaskManager extends Emitter {
return this.tasks.size;
}
async newTask(type, opts) {
async newTask(type, opts, sticky = false) {
this.logger.info({opts}, `initiating Background task ${type}`);
if (this.tasks.has(type)) {
this.logger.info(`Background task ${type} is running, skipped`);
@@ -52,6 +52,7 @@ class BackgroundTaskManager extends Emitter {
if (task) {
this.tasks.set(type, task);
}
if (task && sticky) task.sticky = true;
return task;
}
@@ -116,7 +117,7 @@ class BackgroundTaskManager extends Emitter {
this._taskCompleted('bargeIn', task);
if (task.sticky && !this.cs.callGone && !this.cs._stopping) {
this.logger.info('BackgroundTaskManager:_initBargeIn: restarting background bargeIn');
this.newTask('bargeIn', opts);
this.newTask('bargeIn', opts, true);
}
return;
})