Repository navigation
Wait for backend migrations before starting stats and the indexers - #3
Merged
Merged
Conversation
stats started alongside the backend, ran its first update against an
empty database ("relation blocks does not exist") and rescheduled the
daily groups ~23 h out, so the home page's daily figures read NaN for a
day after every fresh start. user-ops-indexer and the media worker hit
the same race as restart loops. The backend now has a healthcheck on
/api/health/liveness, which answers only after create_and_migrate, and
the three dependants wait for service_healthy. Reproduced and verified on
a clean local stack 2026-09-30: no database errors, no restarts, stats
populated on first run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Evangel90
requested review from
Levi-Ojukwu,
OlolaJaco,
Psalmuel01 and
defidevrel
as code owners
September 30, 2026 01:22
Evangel90
removed request for
Levi-Ojukwu,
OlolaJaco,
Psalmuel01 and
defidevrel
September 30, 2026 01:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a fresh stack the explorer home page showed NaN for daily transactions (and the 24h stats) for up to a day.
Cause:
stats,user-ops-indexerandnft-media-handlerdepended on the backend withcondition: service_started, which doesn't wait for its database migrations. stats ran its first update against an empty database (relation "blocks" does not exist), and after a failure it scheduled the daily groups about 23 h out (83514s). The frontend renders the resultingnullas NaN. The other two services hit the same race as restart loops (4 and 1 restarts).Fix:
curl -fsS http://localhost:4000/api/health/liveness. The API only answers aftercreate_and_migratefinishes incommand. Liveness, not readiness, because readiness also judges indexing lag and would flap on a busy chain.start_period: 5mgives a fresh database time to migrate.condition: service_healthy.This affects every network, devnet-1's first day included. Separate from #2 (devnet env); no conflict expected.
Test plan
.env.local, dev chain 56670): stats logs full ofrelation "blocks" does not exist, daily groups rescheduled ~23 h, home page NaNdown -v+up -dfrom a clean database: backendhealthy, stats hit 0 database errors, 0 restarts across all containers, and/api/v1/pages/main/pages/transactionspopulated on the first run (yesterday_transactions 0, transactions_24h 26, 30-point daily chart)docker compose --env-file .env.local config -q🤖 Generated with Claude Code