Repository navigation
Conversation
- Retry the database connection on a timer instead of calling
SetFailState() when the connect fails
(new cvar sm_vip_test_reconnect_interval, default 30s).
- Detect lost connections in query callbacks ("gone away",
"Lost connection", ...), drop the dead handle and reconnect.
- Guard every query path against a null database handle and tell
the player the database is unavailable (new VIP_DB_UNAVAILABLE
phrase). Test VIP is no longer granted if it can't be saved.
- Reload in-game players once the connection is (re)established.
Bumped plugin version to 1.0.10.
Closes #13
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.
Closes #13
Summary
Adds SQL auto reconnect, inspired by SourceBans++ (lazy reconnect guarded by a "connecting" flag).
SetFailState(). The error is logged and a new connect attempt is scheduled aftersm_vip_test_reconnect_intervalseconds (new cvar, default30, min5).HandleQueryError()helper. When the error looks like a lost connection (gone away,Lost connection,Can't connect,Broken pipe), the dead handle is dropped and a reconnect starts.sm_testvip/sm_viptest,sm_clear_viptest,OnClientPostAdminCheckandGiveVIPToClientall check the database first. Players get a newVIP_DB_UNAVAILABLEmessage (en/ru/fi/fr). Test VIP is no longer granted when it can't be written to the database.1.0.10.Test plan
sm_testvipwhile the DB is down →VIP_DB_UNAVAILABLEmessage, no VIP grantedvip_testentry in databases.cfg) still works🤖 Generated with Claude Code