Skip to content

Commit

Permalink
limit report history to 1 month for initial sync
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght committed Dec 10, 2023
1 parent 5441a59 commit 5bb4d9b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/sync/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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[] = [];

Expand Down Expand Up @@ -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[] = [];

Expand Down

0 comments on commit 5bb4d9b

Please sign in to comment.