@cap-js-community/event-queue 1.2.3 → 1.2.4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js-community/event-queue",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "An event queue that enables secure transactional processing of asynchronous events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",
|
|
3
|
+
"version": "1.2.4",
|
|
4
|
+
"description": "An event queue that enables secure transactional processing of asynchronous and periodic events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
@@ -21,7 +21,7 @@ const SELECT_LIMIT_EVENTS_PER_TICK = 100;
|
|
|
21
21
|
const TRIES_FOR_EXCEEDED_EVENTS = 3;
|
|
22
22
|
const EVENT_START_AFTER_HEADROOM = 3 * 1000;
|
|
23
23
|
|
|
24
|
-
let serviceBindingCache =
|
|
24
|
+
let serviceBindingCache = null;
|
|
25
25
|
|
|
26
26
|
class EventQueueProcessorBase {
|
|
27
27
|
#eventsWithExceededTries = [];
|
|
@@ -700,13 +700,16 @@ class EventQueueProcessorBase {
|
|
|
700
700
|
}
|
|
701
701
|
|
|
702
702
|
async #getServiceBindings() {
|
|
703
|
-
if (serviceBindingCache && serviceBindingCache.
|
|
704
|
-
|
|
703
|
+
if (!(serviceBindingCache && serviceBindingCache.expireTs >= Date.now())) {
|
|
704
|
+
const mtxServiceManager = require("@sap/cds-mtxs/srv/plugins/hana/srv-mgr");
|
|
705
|
+
serviceBindingCache = {
|
|
706
|
+
expireTs: Date.now() + 10 * 60 * 1000,
|
|
707
|
+
value: mtxServiceManager.getAll().catch(() => {
|
|
708
|
+
serviceBindingCache = null;
|
|
709
|
+
}),
|
|
710
|
+
};
|
|
705
711
|
}
|
|
706
|
-
|
|
707
|
-
serviceBindingCache.value = await mtxServiceManager.getAll();
|
|
708
|
-
serviceBindingCache.exipreTs = Date.now() + 10 * 60 * 1000;
|
|
709
|
-
return serviceBindingCache.value;
|
|
712
|
+
return await serviceBindingCache.value;
|
|
710
713
|
}
|
|
711
714
|
|
|
712
715
|
async #selectLastSuccessfulPeriodicTimestamp() {
|