qrusty-client 0.20.9 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +37 -0
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -498,6 +498,43 @@ class WsSession {
|
|
|
498
498
|
await this._request({ type: "nack", queue, id });
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
+
/**
|
|
502
|
+
* Negative-acknowledge a message and defer redelivery for
|
|
503
|
+
* `delaySecs` seconds.
|
|
504
|
+
*
|
|
505
|
+
* The broker parks the message in "in-escrow" state (no consumer
|
|
506
|
+
* owns it, but `locked_until > now`) so it is invisible to pop
|
|
507
|
+
* for the requested delay. After the delay elapses the broker's
|
|
508
|
+
* periodic unlock-expired sweep promotes it back to available and
|
|
509
|
+
* the next eligible subscriber will see it.
|
|
510
|
+
*
|
|
511
|
+
* Intended for the throttle-yield pattern: a worker that is
|
|
512
|
+
* throttled against an upstream releases its credit immediately
|
|
513
|
+
* but tells the broker not to redeliver the message for at least
|
|
514
|
+
* the duration of the throttle backoff, so the next attempt
|
|
515
|
+
* happens after the cooldown rather than into it.
|
|
516
|
+
*
|
|
517
|
+
* `delaySecs` of 0 is allowed and is equivalent to a regular
|
|
518
|
+
* {@link nack} (the unlock-expired sweep picks it up on its next
|
|
519
|
+
* pass).
|
|
520
|
+
*
|
|
521
|
+
* @param {string} queue
|
|
522
|
+
* @param {string} id
|
|
523
|
+
* @param {number} delaySecs Non-negative integer seconds.
|
|
524
|
+
* @returns {Promise<void>}
|
|
525
|
+
*/
|
|
526
|
+
async nackWithDelay(queue, id, delaySecs) {
|
|
527
|
+
if (!Number.isInteger(delaySecs) || delaySecs < 0) {
|
|
528
|
+
throw new TypeError("delaySecs must be a non-negative integer");
|
|
529
|
+
}
|
|
530
|
+
await this._request({
|
|
531
|
+
type: "nack-with-delay",
|
|
532
|
+
queue,
|
|
533
|
+
id,
|
|
534
|
+
delay_secs: delaySecs,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
|
|
501
538
|
/**
|
|
502
539
|
* Batch-acknowledge multiple messages.
|
|
503
540
|
* @param {string} queue
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qrusty-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Node.js client for the qrusty priority queue server API.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Gordon Greene <greeng3@obscure-reference.com>",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"docs": "jsdoc -c jsdoc.json"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"axios": "^1.
|
|
14
|
-
"ws": "^8.
|
|
13
|
+
"axios": "^1.16.1",
|
|
14
|
+
"ws": "^8.21.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"jest": "30.
|
|
17
|
+
"jest": "30.4.2",
|
|
18
18
|
"jsdoc": "^4.0.5"
|
|
19
19
|
}
|
|
20
20
|
}
|