
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
node-distributed-debounce
Advanced tools
debounce function for distributed system with redis and nodejs.
$ npm i -S node-distributed-debounce
example:
import { distributedDebounce } from 'node-distributed-debounce';
// const { distributedDebounce } = require('node-distributed-debounce');
import redis from 'redis';
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
const redisclient = redis.createClient();
function debouncedCall(index: number) {
distributedDebounce(() => {
console.log('called', index);
}, {
wait: 5, // sec
key: 'dist:debounce:call', // key for debounce
redisclient,
}).catch(e => console.error(e));
}
function main() {
for (let i = 0; i < 10; i++) {
debouncedCall(i);
wait(100);
}
}
output:
called 9
FUNCTION DISTRIBUTED_DEBOUCE(key, wait, callback)
currentCounter = MULTI
INCR(key)
EXPRE(key, wait)
EXEC
SLEEP(wait)
counter = GET(key)
IF currentCounter != counter
EXIT
END
IF SET(key_lock, '', NX, PX, 100) != OK
EXIT
END
callback()
FAQs
debounce function for distributed system with redis and nodejs.
The npm package node-distributed-debounce receives a total of 535 weekly downloads. As such, node-distributed-debounce popularity was classified as not popular.
We found that node-distributed-debounce 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
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.