![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
jobq
Advanced tools
Readme
Async and parallel execution of jobs, tasks and processes. This library is aimed to solve the problem of having to limit how many parallel tasks you want to perform. It accepts several kinds of sources including Arrays, Promises, Functions, etc.
npm install --save jobq
var jobQ = require('jobq')
var queue = new jobQ({
process: function(x, callback){
setTimeout(function() {
callback(null, x)
}, 3000)
},
source: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
maxProceses: 2
})
queue.start()
<Number>
indicates how many jobs will run in parallel. A value of 0
means 'no limit'. Default 1
<Boolean>
enables or disables debug. Default false
<Boolean>
indicates if jobs will stop after first error or continue. If enabled, processFinish
will be called with status error
if an error occurs. Default false
<Number>
pooling timeout in milliseconds. When enabled, JobQ will continue to try and fetch data from the source (Function
only). Default: No poolingvar queue = new jobQ({
process: myProcess,
source: mySource,
maxProceses: 2
})
queue.on('start', function(){})
queue.on('jobFetch', function(){})
queue.on('jobRun', function(){})
queue.on('jobFinish', function(){})
queue.on('processFinish', function(){})
queue.on('pooling', function(){})
queue.on('pause', function(){})
queue.on('resume', function(){})
queue.on('error', function(){})
queue.start()
Emited once after calling start()
with an object containing:
<Date>
date when start was called<Number>
jobs processed so far<Number>
jobs errored so far<Number>
maxProceses passed to constructor. Default 1
<Boolean>
stopOnError passed to constructor. Default false
<String>
Detected source type (array
, function
, promise
or stream
).<String>
queue status. will always be running at this point.Emited once for each job before fetching it from the queue with an object containing:
<Number>
current amount of processing jobs. It will not count the one that triggered the event.Emited once for each job when it starts running with:
<number>
job id (autoincrement)Emited once after calling start()
with an object containing:
<Number>
job id<Date>
date when job started to process<Date>
date when job finishes to process<any>
job result received<Number>
current amount of processing jobs. It will count the one that triggered the event.Emited once after calling start()
with an object containing:
<Date>
date when start was called<Date>
date when queue was fully processed<Number>
total amount of jobs processed<Number>
total amount of errors<Number>
maxProceses passed to constructor. Default 1
<Boolean>
stopOnError passed to constructor. Default false
<String>
Detected source type (array
, function
, promise
or stream
).<String>
queue status. will always be finished
or error
.Emited every time the source function returns null
as value and JobQ starts waiting to check again. Only emited if pooling
is enabled, with an object containing:
<Date>
date when start was called<Number>
jobs processed so far<Number>
jobs errored so far<Number>
maxProceses passed to constructor. Default 1
<Boolean>
stopOnError passed to constructor. Default false
<String>
Detected source type (array
, function
, promise
or stream
).<String>
queue status. will always be pooling at this point.Emited once after calling pause()
with an object containing:
<Date>
date when start was called<Number>
jobs processed so far<Number>
jobs errored so far<Number>
maxProceses passed to constructor. Default 1
<Boolean>
stopOnError passed to constructor. Default false
<String>
Detected source type (array
, function
, promise
or stream
).<String>
queue status. will always be paused at this point.Emited once after calling resume()
with an object containing:
<Date>
date when start was called<Number>
jobs processed so far<Number>
jobs errored so far<Number>
maxProceses passed to constructor. Default 1
<Boolean>
stopOnError passed to constructor. Default false
<String>
Detected source type (array
, function
, promise
or stream
).<String>
queue status. will always be running at this point.Emited once for each job error:
<Error>
error receivedSource is where data will be fetched in order to be processed. It can be one of the following:
<Array>
like [1, 2, 3]
.<Array>
of promise like [promise1, promise2, promise3]
.<Function>
returning a value.<Function>
returning a promise.<Function(callback)>
returning nothing and passing data to callback
with error as the first parameter and response as the second one.<ReadableStream>
that supports on('readable')
and read()
.<Promise>
that resolves to any of the previous source types.IMPORTANT: When using Function
and Promise
sources, you must pass null
as value to stop execution.
Process function receives a value from the queue and be anby of the following:
<Function>
that returns a value<Function>
that returns a Promise wich resolves to a value<Function(callback)>
that returns nothing and executes a callback
with error as the first parameter and response as the second one.FAQs
Async and parallel execution of jobs, tasks and processes with a queue manager
The npm package jobq receives a total of 14 weekly downloads. As such, jobq popularity was classified as not popular.
We found that jobq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.