• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LFDT-Panurus / panurus / 37432882035
85%

Build:
DEFAULT BRANCH: main
Ran 06 Oct 2026 08:05AM UTC
Jobs 0
Files 0
Run time –
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
37432882035

push

github

AkramBitar
perf(storage): index tokens.amount and offer a bounded spendable query

The tokens table has a queryable amount NUMERIC(78, 0) column, but nothing
indexed it and the spendable-token query expressed no amount predicate, no
ORDER BY and no LIMIT. Every selection read the wallet's whole spendable set for
the token type and re-parsed each hex quantity in Go, at a cost linear in wallet
size and repeated on every retry.

Add the three storage primitives the column needs:

- idx_spendable_amount on (owner_wallet_id, token_type, amount), partial on
  is_deleted = false AND owner = true AND spendable = true. With equality on the
  first two columns it covers an amount range and an ordering by amount with no
  sort step. It is a CREATE INDEX IF NOT EXISTS in GetSchema, which is applied
  idempotently, so existing databases pick it up on next start.

- MinAmount/MaxAmount on QueryTokenDetailsParams, interpreted in
  HasTokenDetails, so an amount range is expressible at all. Both bounds are
  inclusive and are bound as the decimal text StoreToken writes, so the backend
  compares them as exact numerics.

- QuerySpendableTokens(ctx, SpendableTokensQuery), adding those bounds plus an
  optional order and limit for callers that need only a window of the set.

SpendableTokensIteratorBy now delegates to QuerySpendableTokens and renders
byte-identical SQL, so the selector's hot path is unchanged: it shuffles its rows
to spread contention across concurrent selections, and an order imposed by the
database would be discarded. Ordering is therefore opt-in.

Ordering is by amount alone so the index satisfies the sort. Tokens of equal
amount come back in unspecified order, which makes Limit a window rather than a
page, so no Offset is offered.

Every prepared-statement cache key on a path that renders the new predicates
grows to cover them, so two queries whose SQL differs cannot be handed each
other's cached statement. That is spendableTokensStmtKey for the spendable
query,... (continued)
Source Files on build 37432882035
Detailed source file information is not available for this build.
  • Back to Repo
  • Github Actions Build #37432882035
  • 23b63ff8 on github
  • Prev Build on main (#37309761577)
  • Next Build on main (#37441198368)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc