Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions internal/mcp/storage/notifier/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,12 @@ func (r *RedisNotifier) Watch(ctx context.Context) (<-chan *config.MCPConfig, er

ch := make(chan *config.MCPConfig, 10)

// Capture the current tail before starting the watch loop so callers do not
// miss updates published immediately after Watch returns.
lastID := "0-0"
latest, err := r.client.XRevRangeN(ctx, r.streamName, "+", "-", 1).Result()
if err != nil && !errors.Is(err, redis.Nil) {
return nil, fmt.Errorf("failed to get stream tail: %w", err)
}
if len(latest) > 0 {
lastID = latest[0].ID
}

go func() {
defer close(ch)

// Start from the latest message ($ means read only new messages)
lastID := "$"

for {
select {
case <-ctx.Done():
Expand Down
Loading