
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Push promise-returning functions to the queue. Set the concurrency, and optionally a cooldown.
The queue is best understood as an airport runway: each function takes off with a minimum distance of the cooldown in milliseconds. Concurrency is the number of flights that can currently be in the air. When promises resolve, the plane has landed.
npm install housecall
var housecall = require('housecall');
var axios = require('axios');
var queue = housecall({ concurrency: 2, cooldown: 1000 });
queue.push(() => axios.get('https://twitter.com/').then((response, body) => {
// The eventual response of Twitter
}));
// This request will not start until 1000 ms after the above.
queue.push(() => axios.get('https://some.com/').then((response, body) => {
// ...
}));
// This will not run until of the above have terminated.
queue.push(() => axios.get('https://test.com/').then((response, body) => {
// ...
}));
Make sure you wrap the function. Otherwise it will run immediately, and defeat the purpose of the queue.
// WILL NOT BE CORRECTLY ENQUEUED
queue.push(axios.get('https://twitter.com/').then((response, body) => {
// The queue will not control the start of execution here.
}));
Whenever the queue is empty after handling tasks, it will emit an 'idle' event.
queue.on('idle', function(noTasksCompleted, noTasksWithError) {
// Do something
});
The queue continues on any error, but the error will be outputted to stdout.
FAQs
A promise queue. Simple and sweet.
We found that housecall demonstrated a not healthy version release cadence and project activity because the last version was released 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
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.