fix: prevent Docker restart loop on auth failure#36
Merged
Conversation
Two changes to stop the bot from restarting indefinitely when credentials are wrong: 1. Exit with code 0 on authentication errors (Docker only restarts on non-zero exit when policy is on-failure) 2. Change docker-compose restart policy from unless-stopped to on-failure so transient errors (exit 1) restart but permanent auth failures (exit 0) stay stopped Closes #35
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.
Problem
When the bot fails to authenticate (wrong password, user not found, IP blocked), Docker's
restart: unless-stoppedrestarts it indefinitely regardless of exit code, causing IP-based rate limiting and account lockout.Fix
1.
cmd/bot/main.go— Exit code 0 on auth errorDocker
on-failureonly restarts on non-zero exit codes. By exiting with code 0 on authentication failures, the container stays stopped permanently.2.
docker-compose.yml—restart: on-failureTransient errors (exit != 0, like network blips) still restart. Permanent auth errors (exit 0) keep the container stopped.
unless-stoppedon-failureCloses #35