Skip to content

Commit a104b92

Browse files
kx-byteiFurySt
authored andcommitted
fix: upgrade CI Go version and close redis watch race
1 parent 18bd4e9 commit a104b92

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Set up Go
6969
uses: actions/setup-go@v4
7070
with:
71-
go-version: '1.24.1'
71+
go-version: '1.25.0'
7272
cache: true
7373

7474
- name: Run Go Tests and Coverage
@@ -91,11 +91,10 @@ jobs:
9191
- name: Set up Go
9292
uses: actions/setup-go@v4
9393
with:
94-
go-version: '1.24.1'
94+
go-version: '1.25.0'
9595

9696
- name: Check if builds succeed
9797
run: |
9898
go build -v ./cmd/apiserver
9999
go build -v ./cmd/mcp-gateway
100100
go build -v ./cmd/mock-server
101-

internal/mcp/storage/notifier/redis.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,20 @@ func (r *RedisNotifier) Watch(ctx context.Context) (<-chan *config.MCPConfig, er
6464

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

67+
// Capture the current tail before starting the watch loop so callers do not
68+
// miss updates published immediately after Watch returns.
69+
lastID := "0-0"
70+
latest, err := r.client.XRevRangeN(ctx, r.streamName, "+", "-", 1).Result()
71+
if err != nil && !errors.Is(err, redis.Nil) {
72+
return nil, fmt.Errorf("failed to get stream tail: %w", err)
73+
}
74+
if len(latest) > 0 {
75+
lastID = latest[0].ID
76+
}
77+
6778
go func() {
6879
defer close(ch)
6980

70-
// Start from the latest message ($ means read only new messages)
71-
lastID := "$"
72-
7381
for {
7482
select {
7583
case <-ctx.Done():

0 commit comments

Comments
 (0)