Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Add MRT backfill job (#347)

authored by

Caleb McQuaid and committed by
GitHub
30db3f44 099db888

+5 -3
+5 -3
server/workers_jobs/RefreshMRTDecisionsMaterializedViewJob.ts
··· 25 25 throw new Error('No last_insert timestamp found for the table'); 26 26 } 27 27 28 - const oneMinutePrevious = new Date( 29 - lastTimestamp.last_insert.valueOf() - MINUTE_MS, 30 - ); 28 + // When last_insert is null (fresh deploy), do a full backfill 29 + const isInitialBackfill = lastTimestamp.last_insert == null; 30 + const oneMinutePrevious = isInitialBackfill 31 + ? new Date(0) 32 + : new Date(lastTimestamp.last_insert.valueOf() - MINUTE_MS); 31 33 32 34 const insertedRows = await trx 33 35 .insertInto('manual_review_tool.dim_mrt_decisions_materialized')