@proca/queue
Version:
This package provides a **robust RabbitMQ consumer** for processing Proca **action** and **event** messages with strict retry, dead-letter, and crash semantics.
8 lines (7 loc) • 349 B
text/typescript
export const pause = (time?: number): Promise<any> => {
const min = (time && time > 2) ? time / 2 : 1;
const max = time ? time * 2 : 2; // wait between min time/2 and time*2
time = Math.floor(Math.random() * (max - min + 1) + min) * 1000;
console.log("wait", time);
return new Promise(resolve => setTimeout(() => resolve(time), time));
};