Skip to content

Commit d68cc31

Browse files
authored
Fix periodic events CAP (#366)
* fix periodic events CAP * fix periodic events CAP * fix periodic events CAP * fix periodic events CAP * fix periodic events CAP --------- Co-authored-by: Max Gruenfelder <maximilian.gruenfelder@sap.com>
1 parent 80bce16 commit d68cc31

File tree

8 files changed

+288
-66
lines changed

8 files changed

+288
-66
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## v1.10.10 - 2025-07-09
9+
10+
### Fixed
11+
12+
- [CAP outbox] adding periodic events of CAP services with the same action name
13+
814
## v1.10.9 - 2025-07-07
915

1016
### Fixed

package-lock.json

Lines changed: 69 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cap-js-community/event-queue",
3-
"version": "1.10.9",
3+
"version": "1.10.10",
44
"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.",
55
"main": "src/index.js",
66
"types": "src/index.d.ts",
@@ -54,17 +54,17 @@
5454
"yaml": "^2.7.1"
5555
},
5656
"devDependencies": {
57-
"@cap-js/cds-test": "^0.3.0",
57+
"@cap-js/cds-test": "^0.4.0",
5858
"@cap-js/hana": "^2.1.0",
5959
"@cap-js/sqlite": "^2.0.1",
60-
"@sap/cds": "^9.0.3",
61-
"@sap/cds-dk": "^9.0.4",
60+
"@sap/cds": "^9.1.0",
61+
"@sap/cds-dk": "^9.1.0",
6262
"eslint": "^8.57.0",
6363
"eslint-config-prettier": "^9.1.0",
6464
"eslint-plugin-jest": "^28.6.0",
6565
"eslint-plugin-node": "^11.1.0",
6666
"express": "^4.21.2",
67-
"hdb": "^0.19.10",
67+
"hdb": "^2.25.1",
6868
"jest": "^29.7.0",
6969
"prettier": "^2.8.8",
7070
"sqlite3": "^5.1.7",

src/config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,11 @@ class Config {
484484
delete base.interval;
485485
}
486486

487-
result[fnName] = Object.assign(
487+
const subType = `${name}.${fnName}`;
488+
result[subType] = Object.assign(
488489
{
489490
type: CAP_EVENT_TYPE,
490-
subType: `${name}.${fnName}`,
491+
subType,
491492
impl: "./outbox/EventQueueGenericOutboxHandler",
492493
internalEvent: true,
493494
},

src/periodicEvents.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const COMPONENT_NAME = "/eventQueue/periodicEvents";
1515

1616
const checkAndInsertPeriodicEvents = async (context) => {
1717
const now = new Date();
18+
cds.log(COMPONENT_NAME).info("updating periodic events", {
19+
tenant: context.tenant,
20+
});
1821
const tx = cds.tx(context);
1922
const baseCqn = SELECT.from(eventConfig.tableNameEventQueue)
2023
.where([

src/runner/runner.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ const _checkPeriodicEventsSingleTenantOneTime = async () => {
509509
tenantScoped: false,
510510
});
511511
if (!couldAcquireLock) {
512+
logger.info("skipping updating periodic events - lock not acquired");
512513
return;
513514
}
514515
return await cds.tx({}, async (tx) => await periodicEvents.checkAndInsertPeriodicEvents(tx.context));

test/__snapshots__/admin-service.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ exports[`admin-service-test metadata snapshot 1`] = `
234234
</edmx:Edmx>"
235235
`;
236236

237-
exports[`admin-service-test not allowed if disabled by config 1`] = `[Error: 403 - Admin service is disabled by configuration]`;
237+
exports[`admin-service-test not allowed if disabled by config 1`] = `[AxiosError: 403 - Admin service is disabled by configuration]`;
238238

239239
exports[`admin-service-test read entities: Event 1`] = `
240240
{

0 commit comments

Comments
 (0)