Skip to content

fix(api): tally system rework - #2430

Merged
mogery merged 1 commit into
mainfrom
mog/fix-tally
Nov 25, 2025
Merged

mogery merged 1 commit into
mainfrom
mog/fix-tally

Conversation

@mogery

@mogery mogery commented Nov 21, 2025

Copy link
Copy Markdown
Member

Summary by cubic

Reworked the billing tally flow to decouple billing from tally updates using a Redis-backed queue and a periodic worker. This reduces DB load and adds clear visibility into pending tallies.

  • New Features
    • After successful billing, teams are added to a Redis set billed_teams.
    • The index worker runs every 5 minutes, processes up to 100 team IDs from the set, and calls update_tally_5_team for each.
    • Added Prometheus gauge billed_teams_count to track the backlog of billed but not yet tallied teams.

Written for commit 6393468. Summary will update automatically on new commits.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@mogery

mogery commented Nov 25, 2025

Copy link
Copy Markdown
Member Author

@cubic-dev-ai re-review pls

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

@cubic-dev-ai re-review pls

@mogery I've started the AI code review. It'll take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="apps/api/src/services/billing/batch_billing.ts">

<violation number="1" location="apps/api/src/services/billing/batch_billing.ts:322">
Redis enqueue for billed teams lacks error handling, so a Redis hiccup makes `supaBillTeam` reject after billing succeeds, dropping the queue item and leaving the team never tallied.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Comment thread apps/api/src/services/billing/batch_billing.ts
@mogery
mogery merged commit c9ab3ad into main Nov 25, 2025
6 of 8 checks passed
jerbao pushed a commit to jerbao/firecrawl-custom that referenced this pull request Aug 22, 2026
zeekay pushed a commit to Dream-AI-4444/firecrawl that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant