New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@coya/task-manager

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coya/task-manager - npm Package Compare versions

Comparing version

to
0.1.4

32

js/TaskManager.js

@@ -136,9 +136,7 @@ "use strict";

this.logs.info('Task "' + task.name + '" stopped and removed from the tasks list.');
if (this._tasks.length == 0)
if (!this._tasks.length)
this.endTaskManager();
}
else if (result && result.stopAll) {
this.cancelAllTasks();
else if (result && result.stopAll)
this.endTaskManager();
}
else

@@ -152,9 +150,7 @@ this.scheduleTask(task);

this.logs.error('Task "' + task.name + '" stopped and removed from the tasks list.');
if (this._tasks.length == 0)
this.endTaskManager();
if (!this._tasks.length)
this.endTaskManager(true);
}
else if (error && error.stopAll) {
this.cancelAllTasks(true);
this.endTaskManager();
}
else if (error && error.stopAll)
this.endTaskManager(true);
else

@@ -170,5 +166,12 @@ this.scheduleTask(task);

}
endTaskManager() {
endTaskManager(isError) {
if (!this._isEnded) {
this._isEnded = true;
if (this._tasks.length) {
this._tasks.forEach((task) => {
task.cancel();
});
this._tasks = [];
(isError ? this.logs.error : this.logs.info).call(this, 'All tasks have been cancelled and removed from the tasks list.');
}
if (this._end)

@@ -178,10 +181,3 @@ this._end();

}
cancelAllTasks(isError) {
this._tasks.forEach((task) => {
task.cancel();
});
this._tasks = [];
(isError ? this.logs.error : this.logs.info)('All tasks have been cancelled and removed from the tasks list.');
}
}
exports.TaskManager = TaskManager;
{
"name": "@coya/task-manager",
"version": "0.1.3",
"version": "0.1.4",
"description": "Scheduler for run tasks successively or simultaneously",

@@ -5,0 +5,0 @@ "main": "js/TaskManager.js",