fix: revert redis notifier watch change#314
Merged
iFurySt merged 1 commit intoAmoyLab:mainfrom Apr 22, 2026
Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR simplifies Redis stream watching for MCP config updates by reverting a previous optimization and always starting the consumer from the latest message ID, ensuring Watch only delivers new updates after subscription begins. Sequence diagram for RedisNotifier Watch starting from latest Redis stream messagesequenceDiagram
actor WatchCaller
participant RedisNotifier
participant RedisClient
participant RedisStream
participant MCPConfigChannel
WatchCaller->>RedisNotifier: Watch(ctx)
activate RedisNotifier
RedisNotifier->>RedisNotifier: create buffered channel (size 10)
RedisNotifier->>RedisNotifier: start goroutine
deactivate RedisNotifier
par WatchLoop
activate RedisNotifier
RedisNotifier->>RedisNotifier: lastID = $
loop read new messages
RedisNotifier->>RedisClient: XRead from RedisStream starting at lastID
RedisClient-->>RedisNotifier: new messages
RedisNotifier->>MCPConfigChannel: push *MCPConfig
RedisNotifier->>RedisNotifier: update lastID to latest message ID
end
deactivate RedisNotifier
and ContextCancellation
WatchCaller-->>RedisNotifier: ctx.Done()
RedisNotifier->>MCPConfigChannel: close channel
end
MCPConfigChannel-->>WatchCaller: delivers only messages published after Watch started
Class diagram for RedisNotifier Watch behavior changeclassDiagram
class RedisNotifier {
- client RedisClient
- streamName string
+ Watch(ctx Context) MCPConfigChannel
}
class RedisClient {
+ XRead(streamName string, lastID string) RedisMessages
}
class Context {
+ Done() DoneChannel
}
class MCPConfigChannel {
+ receive() MCPConfig
+ close()
}
class RedisMessages {
+ messages MCPConfig[*]
+ lastID string
}
class MCPConfig
RedisNotifier --> RedisClient : uses
RedisNotifier --> MCPConfigChannel : returns
RedisNotifier --> Context : observes cancellation
RedisClient --> RedisMessages : returns
MCPConfigChannel --> MCPConfig : carries
RedisMessages --> MCPConfig : contains
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Switching
lastIDto$means any messages published beforeWatchstarts will be skipped; if this is intentional, consider expanding the comment to explicitly describe that we only deliver new updates and intentionally ignore historical ones so future readers don’t reintroduce the previous behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Switching `lastID` to `$` means any messages published before `Watch` starts will be skipped; if this is intentional, consider expanding the comment to explicitly describe that we only deliver *new* updates and intentionally ignore historical ones so future readers don’t reintroduce the previous behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
iFurySt
approved these changes
Apr 22, 2026
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.
Summary by Sourcery
Bug Fixes: