From 0cfe1f1d5d68628fee37a3e87e387a56717c562c Mon Sep 17 00:00:00 2001 From: Scott Cytacki Date: Fri, 13 Sep 2024 11:50:12 -0400 Subject: [PATCH] try to increase timeout to 30 minutes According to the FB docs a schedule function like this is triggered by an http request. And http request functions can run up to 60 minutes. --- functions-v2/src/at-midnight.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/functions-v2/src/at-midnight.ts b/functions-v2/src/at-midnight.ts index e4c8cef36..ee6b60d36 100644 --- a/functions-v2/src/at-midnight.ts +++ b/functions-v2/src/at-midnight.ts @@ -8,7 +8,17 @@ import * as logger from "firebase-functions/logger"; // type errors. import {cleanFirebaseRoots} from "../../shared/clean-firebase-roots"; -export const atMidnight = onSchedule("0 7 * * *", runAtMidnight); +export const atMidnight = onSchedule( + { + // Let the function run for 30 minutes. + // From early testing it looks like the function can delete 500 qa roots + // every 5 minutes. + timeoutSeconds: 1800, + // Run the function at 7am UTC or 12am PDT + schedule: "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.