
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
beanstalkd-worker
Advanced tools
npm install --save beanstalkd-worker
import BeanstalkdWorker from 'beanstalkd-worker';
const worker = new BeanstalkdWorker(
host, // beanstalkd host
port, // beanstalkd port
);
It's possible to add a onConnectionError callback when creating the beanstalkd-worker.
This callback is called when the connection to the queue fails.
const worker = new BeanstalkdWorker(host, port, {
onConnectionError: (err, tube) => {
// When there is a connection error, you can stop the watchers
tube.stop();
// Eventually, you can restart the watchers
tube.start();
// You can access also the complete worker:
tube.worker.stop();
// Call process.exit if you want to exit your service completly
process.exit(1);
},
});
worker.spawn(tube, {
// job payload/values
}, {
delay: 0,
priority: 1000,
timeout: 10 * 60 * 1000 // ms
}).then(function (job) {
console.log(job.id);
});
worker.handle(tube, function (payload) {
// Complete job
return Promise.resolve();
// Job error
return Promise.reject();
// Spawn a job
this.spawn(someTub);
// Refresh timeout
this.touch();
// Spawn child job and wait for completion before completing this job
await this.child(anotherTube, {/* payload */});
// Await another job
await this.wait(anotherTube, jobId);
// Puts current job back in queue with delay, does not affect retries counter
return this.delay(5000); // ms, default: original timeout
}, {
tries: 3, // Total amount of tries including the first one
backoff: {
initial: 60 * 1000, // ms
exponential: 1.5 // multiple backoff by N each try
}
});
worker.start(); // Enable handlers and start processing jobs, make sure handlers are setup before calling start
Keep in mind that worker will spawn a connection equal to width * amount of tubes. You'll want to make sure that your server is configured to handle that amount of connections (ulimit).
Use DEBUG=beanstalkd-worker* to enable verbose debugging.
FAQs
High level library for running beanstalkd workers in Node.js
The npm package beanstalkd-worker receives a total of 35 weekly downloads. As such, beanstalkd-worker popularity was classified as not popular.
We found that beanstalkd-worker 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.