From 91e5abe76a78bd9d7428c62ce304a662d3530de8 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Wed, 31 Aug 2022 08:03:51 -0600 Subject: [PATCH] Add query to help avoid timeout --- functions/src/reset-betting-streaks.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/src/reset-betting-streaks.ts b/functions/src/reset-betting-streaks.ts index 56e450fa..94f834b7 100644 --- a/functions/src/reset-betting-streaks.ts +++ b/functions/src/reset-betting-streaks.ts @@ -15,7 +15,10 @@ export const resetBettingStreaksForUsers = functions.pubsub }) const resetBettingStreaksInternal = async () => { - const usersSnap = await firestore.collection('users').get() + const usersSnap = await firestore + .collection('users') + .where('currentBettingStreak', '>', 0) + .get() const users = usersSnap.docs.map((doc) => doc.data() as User)