fix(core): guard OnLogAction until configs are executed (#41)) - #42
Merged
Conversation
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
Right after a crash or plugin reload, OnLogAction could fire and log
No webhook found or specified. even though a webhook is configured.
AutoExecConfig()only queues the cfg exec, it doesn't run it synchronously.SourceMod only guarantees cvar values reflect the config file starting at
OnConfigsExecuted. So the cachedg_sWebhookURL(read in
OnPluginStart) can still be the compiled-in empty default if an admin action gets logged before the config actually executes.The AddChangeHook on the webhook cvar fixes the cache eventually, but too late for whatever
OnLogActioncall already fired in that window.Fix
Re-sync g_sWebhookURL in OnConfigsExecuted (guaranteed to run after configs are applied).
Add a g_bConfigsExecuted guard: OnLogAction now bails out silently until configs have actually executed, instead of racing the cached webhook URL and spamming LogError.
Notes
No behavior change once the plugin is fully initialized — only affects the narrow startup/reload window.
Bumped version to 1.4.3.
Fixes #41