Huge News!Announcing our $40M Series B led by Abstract Ventures.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 0.1.7 to 0.2.0

31

js/TaskManager.js

@@ -69,5 +69,8 @@ "use strict";

}
end(end) {
this._end = end;
onEnd(fct) {
this._onEnd = fct;
}
onTaskEnd(fct) {
this._onTaskEnd = fct;
}
/*** SYNCHRONOUS SECTION ***/

@@ -77,4 +80,6 @@ processSynchronousTasks(tasks) {

this._tasks = tasks;
if (!this._tasks.length)
return this._end();
if (!this._tasks.length) {
this._logs.info('Ending task manager...');
return this._onEnd ? this._onEnd() : null;
}
let timeDiff = this._tasks[0].nextExecutionTime - Date.now();

@@ -90,4 +95,7 @@ if (timeDiff > 0) {

task.incExecutionCounter();
if (result && result.stop)
if (result && result.stop) {
this._logs.info('Task "' + task.name + '" stopped and removed from the tasks list.');
if (this._onTaskEnd)
this._onTaskEnd(task);
}
else if (result && result.stopAll) {

@@ -103,4 +111,7 @@ this._tasks = [];

task.incExecutionCounter(true);
if ((error && error.stop) || task.failedExecutionsInARow >= task.maxFailuresInARow)
if ((error && error.stop) || task.failedExecutionsInARow >= task.maxFailuresInARow) {
this._logs.error('Task "' + task.name + '" stopped and removed from the tasks list.');
if (this._onTaskEnd)
this._onTaskEnd(task);
}
else if (error && error.stopAll) {

@@ -141,2 +152,4 @@ this._tasks = [];

this._logs.info('Task "' + task.name + '" stopped and removed from the tasks list.');
if (this._onTaskEnd)
this._onTaskEnd(task);
if (!this._tasks.length)

@@ -155,2 +168,4 @@ this.endTaskManager();

this._logs.error('Task "' + task.name + '" stopped and removed from the tasks list.');
if (this._onTaskEnd)
this._onTaskEnd(task);
if (!this._tasks.length)

@@ -183,4 +198,4 @@ this.endTaskManager('The last task has been stopped and removed from the tasks list.');

}
if (this._end)
this._end();
if (this._onEnd)
this._onEnd();
}

@@ -187,0 +202,0 @@ }

{
"name": "@coya/task-manager",
"version": "0.1.7",
"version": "0.2.0",
"description": "Scheduler for run tasks successively or simultaneously",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc