config: wire message_interval_time into the rate limiter#529
Open
ZayanKhan-12 wants to merge 1 commit into
Open
config: wire message_interval_time into the rate limiter#529ZayanKhan-12 wants to merge 1 commit into
ZayanKhan-12 wants to merge 1 commit into
Conversation
The websocket rate limiter is constructed with
RateLimit.MessageIntervalTimeSecond, but that field has no JSON tag
and was never populated from the decoded config: only tests set it
directly. For every config-driven deployment, the interval was 0,
and go-rate's Try() never limits with a zero interval - so
"rate_limit": {"enabled": true, ...} silently did nothing.
Populate MessageIntervalTimeSecond from message_interval_time (as
used by examples/server_config.json) when loading the config, and
document the key in the README's rate_limit block.
Co-Authored-By: Claude Fable 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.
Problem
The websocket rate limiter is constructed from
RateLimit.MessageIntervalTimeSecond(server/streaming/socket.go):But that field has no JSON tag and is never populated when the config is loaded — only tests set it directly (
grep -rn MessageIntervalTimeSecondover non-test code finds only the declaration and the read above). For every config-driven deployment the interval is 0, and go-rate'sTry()never limits with a zero interval (diff < r.intervalcan't be true).Net effect:
"rate_limit": {"enabled": true, ...}— as inexamples/server_config.json— silently does nothing.Fix
MessageIntervalTimeSecondfrom the decodedmessage_interval_timevalue (seconds, matching the example config) inloadApplicationConfig.message_interval_timein the README'srate_limitblock, which previously omitted it.go buildandgo vet ./config/...pass locally (the config test binary needs an arm64 libzmq to link, which this machine lacks — CI will exercise it).🤖 Generated with Claude Code