Commit d5cfa20
committed
fix(redis-adapter): resolve timeout when fetching sockets from empty rooms
When calling FetchSockets or AllRooms with Redis adapter in a multi-server
setup, if a room doesn't exist or has no connections on some servers, those
servers return empty arrays. Due to the omitempty JSON tag, the response
field becomes nil after deserialization.
Previously, the code would return early when response.Sockets or
response.Rooms was nil, but MsgCount had already been incremented.
This caused the completion check (MsgCount == NumSub) to never execute,
resulting in the request timing out instead of resolving.
Changed nil checks to len() > 0 checks so that empty responses still
proceed to the completion check, allowing the callback to trigger correctly.
Closes #1111 parent 9d65838 commit d5cfa20
1 file changed
+4
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
623 | | - | |
| 622 | + | |
| 623 | + | |
624 | 624 | | |
625 | | - | |
626 | 625 | | |
627 | 626 | | |
628 | 627 | | |
| |||
637 | 636 | | |
638 | 637 | | |
639 | 638 | | |
640 | | - | |
641 | | - | |
| 639 | + | |
| 640 | + | |
642 | 641 | | |
643 | | - | |
644 | 642 | | |
645 | 643 | | |
646 | 644 | | |
| |||
0 commit comments