From 79b52db4697b491e1b37a4ceeca9b4f682e27125 Mon Sep 17 00:00:00 2001 From: Thad Miller Date: Thu, 5 Mar 2026 07:11:54 -0500 Subject: [PATCH] [chore] added small delay to sync-prices to not be too aggressive --- scripts/sync-prices.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/sync-prices.ts b/scripts/sync-prices.ts index 1b48b5a..41060b9 100644 --- a/scripts/sync-prices.ts +++ b/scripts/sync-prices.ts @@ -12,6 +12,10 @@ const DollarToInt = (dollar: any) => { return Math.round(dollar * 100); } +function sleep(ms: number) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + async function resetProcessingTable() { // Use sql.raw to execute the TRUNCATE TABLE statement await db.execute(sql.raw('TRUNCATE TABLE processingSkus;')); @@ -80,6 +84,8 @@ async function syncPrices() { // remove skus from the 'working' processingSkus table await db.delete(processingSkus).where(inArray(processingSkus.skuId, skuIds)); + // be nice to the API and not send too many requests in a short time + await sleep(100); } }