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.0 to 0.1.1

2

package.json
{
"name": "@coya/task-manager",
"version": "0.1.0",
"version": "0.1.1",
"description": "Scheduler for run tasks successively or simultaneously",

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

@@ -23,3 +23,3 @@ # Task Manager

const firstTask = new Task('firstTask', 10, function() { // processed every 10 seconds
const firstTask = new Task('firstTask', 10, function() {
console.log('hello');

@@ -29,3 +29,3 @@ return Promise.resolve();

const secondTask = new Task('secondTask', 5, function() { // processed every 5 seconds
const secondTask = new Task('secondTask', 5, function() {
console.log('hola');

@@ -35,10 +35,12 @@ return Promise.resolve();

const thirdTask = new Task('thirdTask', 2, function() {
console.log('failure');
return Promise.reject();
});
const taskManager = new TaskManager();
taskManager.processAsynchronousTasks([firstTask, secondTask])
.then(function() {
taskManager.getLogs().info('Task manager stopped.');
}, function(error) {
taskManager.getLogs().error(error);
process.exit(1); // cancel all other scheduled tasks
taskManager.end(function() {
console.log('All tasks have been stopped, task manager shutted down.');
});
taskManager.processAsynchronousTasks([firstTask, secondTask, thirdTask]);
```

@@ -70,2 +72,3 @@

* timeInterval => interval in seconds between each task execution
* runFunction => task function called by the scheduler, it must return a promise (this function can be passed to the Task constructor or be a member method of the inheriting class)
* maxFailuresInARow (optional) => determine the number of failures in a row before the task will be taken out of the task list (default it is 5)
* run => task function called by the scheduler, it must return a promise (this function can be passed to the Task constructor or be a member method of the inheriting class)
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