From 677f8e9afd3aa3d940df3cbe84c2b0c534282439 Mon Sep 17 00:00:00 2001 From: Max Edell Date: Tue, 2 Jun 2026 11:09:04 -0700 Subject: [PATCH 1/2] fix: faster cron --- README.md | 4 ++-- app.config.yaml | 2 +- src/actions/ebs-sync/index.js | 2 +- src/actions/ebs-sync/state.js | 11 +++++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d70edc8..c9dca97 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ Returns the currently deployed version (`{ "version": "..." }`). Used by post-de ### `ebs-sync/ebs-sync` (web action + scheduled) -Synchronizes completed commerce orders to Oracle EBS. Runs on a 10-minute cron schedule and is also available as an HTTP endpoint for status checks and manual triggers. +Synchronizes completed commerce orders to Oracle EBS. Runs on a 5-minute cron schedule and is also available as an HTTP endpoint for status checks and manual triggers. -**Scheduled mode** (every 10 min): Reads the global orders journal since the last cursor, filters to terminal events (`payment_completed` / `payment_cancelled`), and for each completed order builds a SOAP XML payload and POSTs it to EBS via a static-IP proxy. Cancelled orders are skipped. A 15-minute overlap is applied to journal queries to catch late-arriving entries. +**Scheduled mode** (every 5 min): Reads the global orders journal since the last cursor, filters to terminal events (`payment_completed` / `payment_cancelled`), and for each completed order builds a SOAP XML payload and POSTs it to EBS via a static-IP proxy. Cancelled orders are skipped. A 15-minute overlap is applied to journal queries to catch late-arriving entries. **Supported payment methods**: Credit card (Chase), PayPal, Apple Pay (Chase wallet), Affirm. diff --git a/app.config.yaml b/app.config.yaml index 968c329..4eb14d5 100644 --- a/app.config.yaml +++ b/app.config.yaml @@ -101,7 +101,7 @@ application: ebs-sync-schedule: feed: /whisk.system/alarms/alarm inputs: - cron: '*/10 * * * *' + cron: '*/5 * * * *' timezone: UTC rules: diff --git a/src/actions/ebs-sync/index.js b/src/actions/ebs-sync/index.js index f93a4a6..3a4ad5a 100644 --- a/src/actions/ebs-sync/index.js +++ b/src/actions/ebs-sync/index.js @@ -3,7 +3,7 @@ * * Three invocation modes: * - * Scheduled (alarm rule, every 10 min) + * Scheduled (alarm rule, every 5 min) * params.__ow_method is absent. * Runs the full sync job via sync.run(). * diff --git a/src/actions/ebs-sync/state.js b/src/actions/ebs-sync/state.js index b7a0fa4..3973e7a 100644 --- a/src/actions/ebs-sync/state.js +++ b/src/actions/ebs-sync/state.js @@ -16,8 +16,15 @@ import { init } from '@adobe/aio-lib-state'; const STATE_KEY = 'ebs-sync:state'; const LOCK_KEY = 'ebs-sync:lock'; -/** Lock TTL — one full schedule interval plus a generous buffer. */ -const LOCK_TTL_SEC = 660; // 11 minutes +/** + * Lock TTL — must exceed the action's max run duration (the 600000ms / 10-min + * timeout in app.config.yaml) so the lock can never expire while a run is still + * in progress. This is what keeps overlapping triggers from running in parallel: + * the sync fires every 5 minutes but a run may last up to 10, so a trigger that + * fires mid-run must find the lock still held and skip. Do NOT lower this to + * track the schedule interval — it is keyed to run duration, not cron cadence. + */ +const LOCK_TTL_SEC = 660; // 11 minutes (> 10-min max run) /** State TTL — effectively permanent (1 year). */ const STATE_TTL_SEC = 365 * 24 * 3600; From b60f682890c0408c94a71fc3b5caa0d8d87c1f9e Mon Sep 17 00:00:00 2001 From: Max Edell Date: Fri, 12 Jun 2026 12:57:10 -0700 Subject: [PATCH 2/2] fix: force deploy