Commit a8c8c0e
committed
Fix real-time message updates: use blocking Redis XREAD
The chat message list wasn't updating in real-time because XREAD was using
non-blocking mode, causing it to return immediately without waiting for new
messages.
Root cause:
- XREAD_TIMEOUT = 0 was converted to block=None (non-blocking)
- In old aioredis: timeout=0 meant "block forever"
- In new redis library: block=None means "non-blocking" (return immediately)
- This caused XREAD to constantly poll without waiting for messages
Fix:
- Changed to block=5000 (5 seconds) for proper blocking behavior
- XREAD now waits up to 5 seconds for new messages before returning
- Messages now appear in real-time for all connected users
Tested:
- Users connecting to the same room see each other's messages immediately
- Message list updates within milliseconds of sending
- No more need to refresh or reconnect to see new messages1 parent 7e283e6 commit a8c8c0e
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| |||
0 commit comments