From f1419fbb647e9e5833d4a6b32592bcd479c8f433 Mon Sep 17 00:00:00 2001 From: tom <62763456+amplitudesxd@users.noreply.github.com> Date: Wed, 26 Nov 2025 16:44:52 +0000 Subject: [PATCH] fix(api): handle case with no billed teams in tallyBilling function (#2446) --- apps/api/src/services/indexing/index-worker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/api/src/services/indexing/index-worker.ts b/apps/api/src/services/indexing/index-worker.ts index 980923624..fa5711778 100644 --- a/apps/api/src/services/indexing/index-worker.ts +++ b/apps/api/src/services/indexing/index-worker.ts @@ -657,6 +657,12 @@ async function tallyBilling() { "billed_teams", 100, ); + + if (!billedTeams || billedTeams.length === 0) { + logger.debug("No billed teams to process"); + return; + } + await getRedisConnection().srem("billed_teams", billedTeams); logger.info("Starting to update tallies", { billedTeams: billedTeams.length,