@cap-js-community/event-queue 1.0.1 → 1.0.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js-community/event-queue",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
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.",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -151,7 +151,7 @@ class EventQueueProcessorBase {
151
151
 
152
152
  endPerformanceTracerPreprocessing() {
153
153
  this.__performanceLoggerPreprocessing?.endPerformanceTrace(
154
- { threshold: 50 },
154
+ { threshold: this.#config.thresholdLoggingEventProcessing },
155
155
  {
156
156
  eventType: this.#eventType,
157
157
  eventSubType: this.#eventSubType,
@@ -22,8 +22,10 @@ const checkAndInsertPeriodicEvents = async (context) => {
22
22
  },
23
23
  "AND",
24
24
  { ref: ["status"] },
25
- "=",
26
- { val: EventProcessingStatus.Open },
25
+ "IN",
26
+ {
27
+ list: [{ val: EventProcessingStatus.Open }, { val: EventProcessingStatus.InProgress }],
28
+ },
27
29
  ])
28
30
  .columns(["ID", "type", "subType", "startAfter"]);
29
31
  const currentPeriodEvents = await tx.run(baseCqn);
package/src/runner.js CHANGED
@@ -88,6 +88,7 @@ const _checkAndTriggerPeriodicEventUpdate = (tenantIds) => {
88
88
  return;
89
89
  }
90
90
  if (tenantIdHash && tenantIdHash !== hash) {
91
+ tenantIdHash = hash;
91
92
  cds.log(COMPONENT_NAME).info("tenant id hash changed, triggering updating periodic events!");
92
93
  _multiTenancyPeriodicEvents().catch((err) => {
93
94
  cds.log(COMPONENT_NAME).error("Error during triggering updating periodic events!", err);
@@ -300,7 +301,7 @@ const _checkPeriodicEventsSingleTenant = async (context = {}) => {
300
301
  return;
301
302
  }
302
303
  try {
303
- logger.info("executing updating periotic events", {
304
+ logger.info("executing updating periodic events", {
304
305
  tenantId: context.tenant,
305
306
  subdomain: context.http?.req.authInfo.getSubdomain(),
306
307
  });
@@ -116,9 +116,13 @@ const getAllTenantIds = async () => {
116
116
  }
117
117
  const ssp = await cds.connect.to("cds.xt.SaasProvisioningService");
118
118
  const response = await ssp.get("/tenant");
119
- return response.map((tenant) => tenant.subscribedTenantId ?? tenant.tenant);
119
+ return response
120
+ .map((tenant) => tenant.subscribedTenantId ?? tenant.tenant)
121
+ .filter((tenantId) => !isFakeTenant(tenantId));
120
122
  };
121
123
 
124
+ const isFakeTenant = (tenantId) => /00000000-0000-4000-8000-\d{12}/.test(tenantId);
125
+
122
126
  module.exports = {
123
127
  executeInNewTransaction,
124
128
  TriggerRollback,