Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(api): handle case with no billed teams in tallyBilling function (#2446)

tomf1419fbb647e
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,