Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 822b412

Browse files
Merge pull request #1730 from ayushsatyam146/fix-watcher
fix: Fixing the watcher resp updates for new GET.WATCH connections
2 parents 6eb1b40 + 0bc94aa commit 822b412

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ __pycache__
1212
dice
1313
main
1414
tmp/
15+
vendor/
1516

1617
# build output
1718
dist/

internal/server/ironhawk/iothread.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ func (t *IOThread) Start(ctx context.Context, shardManager *shardmanager.ShardMa
8787
t.Mode = _c.C.Args[1]
8888
}
8989

90-
if strings.HasSuffix(c.Cmd, ".WATCH") {
90+
isWatchCmd := strings.HasSuffix(c.Cmd, "WATCH")
91+
92+
if isWatchCmd{
9193
watchManager.HandleWatch(_c, t)
9294
}
9395

@@ -97,8 +99,12 @@ func (t *IOThread) Start(ctx context.Context, shardManager *shardmanager.ShardMa
9799

98100
watchManager.RegisterThread(t)
99101

100-
if sendErr := t.serverWire.Send(ctx, res.Rs); sendErr != nil {
101-
return sendErr.Unwrap()
102+
// Only send the response directly if this is not a watch command
103+
// For watch commands, the response will be sent by NotifyWatchers
104+
if !isWatchCmd{
105+
if sendErr := t.serverWire.Send(ctx, res.Rs); sendErr != nil {
106+
return sendErr.Unwrap()
107+
}
102108
}
103109

104110
// TODO: Streamline this because we need ordering of updates

0 commit comments

Comments
 (0)