Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion app.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ application:
ebs-sync-schedule:
feed: /whisk.system/alarms/alarm
inputs:
cron: '*/10 * * * *'
cron: '*/5 * * * *'
timezone: UTC

rules:
Expand Down
2 changes: 1 addition & 1 deletion src/actions/ebs-sync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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().
*
Expand Down
11 changes: 9 additions & 2 deletions src/actions/ebs-sync/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading