0.0.9 • Published 6 years ago

stevetask v0.0.9

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

How to use

Create 3 files:

  • index.js
  • master.js
  • worker.js

index.js

import Steve from 'stevetasks'
Steve({
    masterScript: __dirname+'/master.js',
    workerScript: __dirname+'/worker.js',
})

master.js

This file need to configure tasks list. You need to write a function to get single task. Ensure to check ignoreIds to return uniq task.

export default (Steve)=>{
    const Jobs = new Steve({
        instances: 8, //default == cpu cores
    
        getTask: async({ignoreIds})=>{
            return {_id:0}
        }
    })

    Jobs.on('task-start', ({_id})=>{})
    Jobs.on('task-done', ({_id})=>{})
    Jobs.on('task-error', ({_id, error})=>{})
    Jobs.on('end', (e)=>{})
}

worker.js

Here will be logic to process single task

export default async (task)=>{
    return true
}
0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago