Repository navigation
Wait for Scylla when the server starts - #52
Merged
Merged
Conversation
When a machine boots, Docker starts the server and Scylla together, and Scylla takes a few seconds to accept connections. The server tried once, exited, and was restarted by Docker until Scylla was up: six times on the production server's last reboot. Now it tries again, with pauses growing from half a second to five, for up to two minutes, and migrate for up to one; both stop waiting as soon as they are stopped. Each attempt builds its cluster afresh, because gocql's token-aware host policy serves one session only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ssenerg
enabled auto-merge (squash)
November 17, 2026 13:44
govulncheck fails CI on Go 1.27.3's GO-2026-6859: a race between http.MaxBytesReader and reading headers can crash an HTTP/1 server, and the web gateway, uploads and pushes all reach it. Go 1.27.4 fixes it. The builder image moves to golang:1.27.4-alpine3.24, pinned by its index digest like before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
When a machine boots, Docker starts the server and Scylla together, and Scylla takes a few seconds to accept connections. The server tried once, exited, and Docker restarted it until Scylla was up: six times on the production server's last reboot (
gocql: unable to create session ... dial tcp), healthy about 25 seconds later. Now the server waits for Scylla instead.What changes
internal/repos/scylla/session.go:OpenandEnsureKeyspacetake a context and try again while Scylla is not reachable, with pauses growing from 500ms to 5s, until the context ends. Each attempt logs a warning with its number and error. Each attempt builds its cluster afresh: gocql's token-aware host policy serves one session only, and reusing the cluster panics on the second attempt.internal/app/server/run.go: the server waits up to two minutes (scyllaStartTimeout). SIGINT and SIGTERM still stop it at once, as the wait uses the signal context.cmd/migrate/scylla.go:migrate scylla upandstatuswait up to a minute.NewRepositorytakes the context too; its one test caller is updated.Tests
session_test.go: against an address nothing listens on,Opentries again several times and gives up soon after its context's deadline; with a canceled context it tries once;EnsureKeyspacewaits too.go test ./...,go test -race ./internal/repos/scylla/, andgolangci-linton the changed packages pass.🤖 Generated with Claude Code