
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
cluster-synchronize
Advanced tools
Runs asynchronous operations synchronously between worker processes.
Runs asynchronous operations synchronously between worker processes.
Note that this module will not turn your operations synchronous, but make them running sequentially to prevent concurrency issues when your program runs in cluster mode.
This module also works with sub-processes forked directly by child_process as long as they are executed with the same path.
This module doesn't rely on cluster and the master process, so it's perfect using it while your program runs under PM2 supervision.
import synchronize from "cluster-synchronize";
import * as cluster from "cluster";
import * as os from "os";
if (cluster.isMaster) {
for (let i=0; i < os.cpus().length; i++) {
let worker = cluster.fork();
// ...
}
} else {
synchronize(async () => {
// Do everything asynchronous and don't worry about concurrency control
// issues.
});
}
synchronize(body: (done?: (err?: any) => void) => void | Promise<void>): Promise<void>
This function returns a promise, so you can wait it finishing running and do other stuff after that.
If you provide the done parameter, you must call it once your job in body is
done. If any error passed to done(), it will be caught by the promise
rejection handler.
If done isn't provided, then the job in body will be automatically handled,
and any error occurred will be caught by the promise rejection handler.
synchronize.setTimeout(timeout: number): void
Sets a timeout to force release the queue for next task. By default, the timeout
is 5000ms.
FAQs
Runs asynchronous operations synchronously between worker processes.
The npm package cluster-synchronize receives a total of 4 weekly downloads. As such, cluster-synchronize popularity was classified as not popular.
We found that cluster-synchronize 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.