![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.
pjobs
Advanced tools
Readme
A simple and efficient queue job executor using promises. And some promise's utilities.
npm install --save pjobs
queuePromises
defines an executor for jobs. A job is just a function that returns a Promise. You can also control concurrency and promises.
import { queuePromises } from 'pjobs'
const queue = queuePromises({
concurrency: 1, // maximum of promises running concurrently
onProgress (status) { // allow you to inform users about execution progress
console.log('done: ', status.percent, '%')
console.log('speed: ', status.rate) // jobs runned per second
console.log('estimated time remaining to finish: ', status.timeRemaining)
}
})
queue.enqueue(async () => { // add a job to the queue
console.log('task 1')
})
queue.enqueue(async () => { // add another job to the queue
console.log('task 2')
})
await queue.waitFor() // wait for all jobs to be finished.
defer
allow you to defer promise's resolving or rejecting.
import { queuePromises, defer } from 'pjobs'
const taskOne = defer<void>() // defines the deferred promise
const queue = queuePromises()
queue.enqueue(async () => {
console.log('task 1')
taskOne.resolve() // resolves the deferred promise
})
queue.enqueue(async () => {
console.log('task 2')
})
expect(queue.state()).not.toBe('idle')
await taskOne.promise // wait for the deferred promise to be resolved
await queue.waitFor()
sleep
allow you pause execution flow for some miliseconds
import { sleep } from 'pjobs'
await sleep(100) // pause execution flow for 100 miliseconds
asap
delay execution of a function to as soon as possible
import { asap } from 'pjobs'
asap(()=>console.log('b')) // 'b' will be logged after 'a'
console.log('a')
FAQs
A simple, efficient, small and no dependencies queue job executor using promises with concurrency control. And some promise's utilities.
The npm package pjobs receives a total of 118 weekly downloads. As such, pjobs popularity was classified as not popular.
We found that pjobs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.