Skip to content

Hotfix v0.40.1 (APP-1313): slow /v2/members and /v2/transactions queries - #1604

Merged
harryburger merged 5 commits into
mainfrom
hotfix/0.40.1-delegator-count
Oct 7, 2026
Merged

harryburger merged 5 commits into
mainfrom
hotfix/0.40.1-delegator-count

Conversation

@arabot-1

@arabot-1 arabot-1 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Task: APP-1313

2 changes since v0.40.0

Fixes

  • fix(transactions): check spam once per token before paging
  • fix(members): count delegators from the index only

Why hotfix
Prod Mongo Atlas CPU spiked on 2026-10-07 (01:30 to 02:45 UTC). A scraper walked /v2/members and /v2/transactions for many DAOs. Two queries took about 14s each on Atlas: member delegation counts on big tokens (ARB, OP) and deep transaction pages (katana DAO, page 448). Any client or bot can trigger them again, so it can't wait for the next release.

What changed

  • Members: the delegator count read every matching delegation log from disk. Now it runs one query for incoming and one for outgoing, each answered from its own index without reading the logs.
  • Transactions: the spam check did a Token lookup on every row before skipping to the page, so page 448 did 22,400 lookups. Now spam is checked once per token in the count query, and the page query skips spam tokens with a plain filter, no lookup per row. includeSpam=true works as before.

Same results as before for both, only faster.

Checked on dev

  • Members, ARB top 50 delegates: 4.7-6.9s before, about 1s now. 1,500 real members on the 10 biggest tokens, 0 mismatches.
  • Transactions, katana DAO: page 448 6.4s → 1.9s, page 900 13.3s → 2.3s, page 1500 19.9s → 3.9s. Same rows and metadata on all checked pages (katana and a 134k-row sepolia DAO).
  • Unit tests: 5 new for members, 8 new for transactions.

@arabot-1
arabot-1 requested a review from a team as a code owner October 7, 2026 03:23
@harryburger harryburger changed the title Hotfix v0.40.1 Hotfix v0.40.1: slow /v2/members and /v2/transactions queries Oct 7, 2026
@linear-code

linear-code Bot commented Oct 7, 2026

Copy link
Copy Markdown

APP-1313

@harryburger harryburger changed the title Hotfix v0.40.1: slow /v2/members and /v2/transactions queries Hotfix v0.40.1 (APP-1313): slow /v2/members and /v2/transactions queries Oct 7, 2026

@milosh86 milosh86 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.

Looks good 👍

@harryburger
harryburger merged commit f072b7f into main Oct 7, 2026
17 checks passed

This branch was successfully deployed

1 active deployment
staging — b082ca6f Deployed Oct 7, 2026 by arabot-1 via deploy-staging / Deploy to staging #73
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.

3 participants