You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(stats): seed account counter with long deadline + retry; never scan on request path (#94)
The one-time account/DID seed called CountAccounts, whose immudb Count over the 'address:' prefix is hard-capped at 30s (Accounts_helper.go) and now exceeds it on the live accounts DB -> DeadlineExceeded. Result: the counter never seeded, and getStats' fallback re-ran the same 30s Count per request and errored the whole /api/stats response.
- GetCountofRecords takes a countTimeout (<=0 => 30s default); GetMainDBCount/GetAccountsDBCount pass 30s (unchanged). New CountBuilder.GetAccountsDBCountWithTimeout + DB_OPs.CountAccountsWithTimeout expose a caller-chosen deadline.
- The one-time seed now uses a 5-min per-attempt deadline and retries with exponential backoff (30s..10m) until it succeeds or the node shuts down; it runs off the request path so a long count never delays startup.
- getStats reads ONLY the sqlite counter (O(1)); it no longer falls back to the immudb Count on the request path. Until the background seed populates the counter it reports 0 (transient) instead of erroring the endpoint.
Verified: gofmt clean; DB_OPs + explorer build; go vet ./ (package main) exit 0.
Co-authored-by: Doc <doc@local>
0 commit comments