From 5bb4d9b1684d23c3a4ed02eb8e984cb43f2c5e9b Mon Sep 17 00:00:00 2001 From: secondl1ght Date: Sun, 10 Dec 2023 00:47:43 -0700 Subject: [PATCH] limit report history to 1 month for initial sync --- src/lib/sync/reports.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/sync/reports.ts b/src/lib/sync/reports.ts index 16bcfc9f..3f81f1dd 100644 --- a/src/lib/sync/reports.ts +++ b/src/lib/sync/reports.ts @@ -8,6 +8,10 @@ axiosRetry(axios, { retries: 3 }); const limit = 20000; +const today = new Date(); +today.setMonth(today.getMonth() - 1); +const monthAgo = today.toISOString(); + export const reportsSync = async () => { // clear v1 table if present await localforage @@ -61,7 +65,7 @@ export const reportsSync = async () => { .then(async function (value) { // get reports from API if initial sync if (!value) { - let updatedSince = '2022-01-01T00:00:00.000Z'; + let updatedSince = monthAgo; let responseCount; let reportsData: Report[] = []; @@ -201,7 +205,7 @@ export const reportsSync = async () => { reportError.set('Could not load reports locally, please try again or contact BTC Map.'); console.log(err); - let updatedSince = '2022-01-01T00:00:00.000Z'; + let updatedSince = monthAgo; let responseCount; let reportsData: Report[] = [];