diff --git a/functions-v2/src/at-midnight.ts b/functions-v2/src/at-midnight.ts index 73923325b..e4c8cef36 100644 --- a/functions-v2/src/at-midnight.ts +++ b/functions-v2/src/at-midnight.ts @@ -8,7 +8,7 @@ import * as logger from "firebase-functions/logger"; // type errors. import {cleanFirebaseRoots} from "../../shared/clean-firebase-roots"; -export const atMidnight = onSchedule("0 0 * * *", runAtMidnight); +export const atMidnight = onSchedule("0 7 * * *", runAtMidnight); // This function is split out so it can be tested by Jest. The // firebase-functions-test library doesn't support wrapping onSchedule. diff --git a/scripts/clean-firebase-roots.ts b/scripts/clean-firebase-roots.ts index 496549366..bd3991279 100644 --- a/scripts/clean-firebase-roots.ts +++ b/scripts/clean-firebase-roots.ts @@ -1,11 +1,11 @@ #!/usr/bin/node -// This script finds documents without metadata in the realtime database. -// If the deleteTypes array is uncommented, it will delete these documents. +// This script cleans the roots out of the QA or Dev sections of +// the Firebase Realtime database and Firestore. // to run this script type the following in the terminal // cf. https://stackoverflow.com/a/66626333/16328462 -// $ cd scripts/ai +// $ cd scripts // $ npx tsx clean-firebase-roots.ts import admin from "firebase-admin"; diff --git a/shared/clean-firebase-roots.ts b/shared/clean-firebase-roots.ts index dc71bffb1..7b300e114 100644 --- a/shared/clean-firebase-roots.ts +++ b/shared/clean-firebase-roots.ts @@ -24,7 +24,7 @@ export async function cleanFirebaseRoots( throw new Error(`Invalid appMode ${appMode}`); } - // Clean up Firestore and Realtime database roots that haven't been updated in a 6 hours + // Clean up Firestore and Realtime database roots that haven't been launched in `hoursAgo` hours const cutOffMillis = Date.now() - hoursAgo*HOUR; const qaRootsResult = await getFirestore() .collection(appMode)