Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
scytacki committed Sep 11, 2024
1 parent 582278f commit 6c92170
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion functions-v2/src/at-midnight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions scripts/clean-firebase-roots.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion shared/clean-firebase-roots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6c92170

Please sign in to comment.