Skip to content

Crytek1012/task-scheduler

Repository files navigation

Task Scheduler

An async task scheduler with support for:

  • Priority-based execution
  • Concurrency limits
  • Task dependencies
  • Optional priority-based deduplication per ID
  • Promise-based task results

Installation

Clone the repository:

git clone https://github.com/crytek1012/task-scheduler.git
cd task-scheduler
npm install

Build:

npm run build

Usage

import { Queue, TaskPriority } from './src';

const queue = new Queue({ concurrency: 2 });

queue.addTask('task-1', TaskPriority.High, async () => {
    console.log('High priority task');
});

queue.addTask('task-2', TaskPriority.Low, async () => {
    console.log('Low priority task');
});

Queue Options

Option Type Default Description
concurrency? number 1 Maximum number of tasks allowed to run in parallel.
removeLowerTasks? boolean false Remove tasks for the same ID if they have a lower priority.

Author

Created by Crytek1012.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors