MCPcopy
hub / github.com/redis/ioredis / push

Method push

lib/cluster/DelayQueue.ts:25–42  ·  view source on GitHub ↗

* Add a new item to the queue * * @param bucket bucket name * @param item function that will run later * @param options

(bucket: string, item: Function, options: DelayQueueOptions)

Source from the content-addressed store, hash-verified

23 * @param options
24 */
25 push(bucket: string, item: Function, options: DelayQueueOptions): void {
26 const callback = options.callback || process.nextTick;
27 if (!this.queues[bucket]) {
28 this.queues[bucket] = new Deque();
29 }
30
31 const queue = this.queues[bucket];
32 queue.push(item);
33
34 if (!this.timeouts[bucket]) {
35 this.timeouts[bucket] = setTimeout(() => {
36 callback(() => {
37 this.timeouts[bucket] = null;
38 this.execute(bucket);
39 });
40 }, options.timeout);
41 }
42 }
43
44 private execute(bucket: string): void {
45 const queue = this.queues[bucket];

Callers 15

wrapMultiResultFunction · 0.45
convertObjectToArrayFunction · 0.45
Commander.tsFile · 0.45
subscribeMethod · 0.45
addMethod · 0.45
initFailoverDetectorMethod · 0.45
connectHandlerFunction · 0.45
delayUntilReadyMethod · 0.45
refreshSlotsCacheMethod · 0.45
tryConnectionMethod · 0.45
handleErrorMethod · 0.45
getInfoFromNodeMethod · 0.45

Calls 1

executeMethod · 0.95

Tested by

no test coverage detected