From ecf3d140d60235807f0f4867adf5e8014022b650 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 10 Apr 2024 16:23:22 -0400 Subject: [PATCH] fix #714 (#715) --- lib/utils/background-task-manager.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/utils/background-task-manager.js b/lib/utils/background-task-manager.js index aa336df8..268d2929 100644 --- a/lib/utils/background-task-manager.js +++ b/lib/utils/background-task-manager.js @@ -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; })