MCPcopy Create free account
hub / github.com/actionhero/node-resque / delDelayed

Method delDelayed

src/core/queue.ts:264–297  ·  view source on GitHub ↗
(q: string, func: string, args: Array<any> = [])

Source from the content-addressed store, hash-verified

262 }
263
264 async delDelayed(q: string, func: string, args: Array<any> = []) {
265 const timestamps = [];
266 args = arrayify(args);
267 const search = this.encode(q, func, args);
268
269 const members = await this.connection.redis.smembers(
270 this.connection.key("timestamps:" + search),
271 );
272
273 const pipeline = this.connection.redis.multi();
274
275 for (const i in members) {
276 const key = members[i];
277 const count = await this.connection.redis.lrem(
278 this.connection.key(key),
279 0,
280 search,
281 );
282 if (count > 0) {
283 timestamps.push(key.split(":")[key.split(":").length - 1]);
284 pipeline.srem(this.connection.key("timestamps:" + search), key);
285 }
286 }
287
288 const response = await pipeline.exec();
289
290 response?.forEach((res) => {
291 if (res[0] !== null) {
292 throw res[0];
293 }
294 });
295
296 return timestamps.map((t) => parseInt(t, 10));
297 }
298
299 /**
300 * - learn the timestamps at which a job is scheduled to be run.

Callers 1

queue.tsFile · 0.80

Calls 3

encodeMethod · 0.95
arrayifyFunction · 0.85
keyMethod · 0.45

Tested by

no test coverage detected