Chunk ledger sync by 30 days (Etsy caps window at 31)

The ledger-entries endpoint rejects ranges over 2678400s (31 days) with
a 400. Reduce the chunk window from 90 to 30 days.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
dlawler489 2026-06-13 15:35:12 +10:00
parent 03979a9b48
commit 7a626257cd

View file

@ -376,7 +376,8 @@ export const syncLedgerEntries = async (
unknownDebits: [],
};
const windowSeconds = 90 * 24 * 60 * 60;
// Etsy caps the ledger query window at 31 days (2678400s); use 30 to be safe
const windowSeconds = 30 * 24 * 60 * 60;
const nowSec = Math.floor(Date.now() / 1000);
let windowStart = Math.floor(startDate.getTime() / 1000);