Commit b76325d
octo-patch
fix(baileys): prevent healthy instances from being killed after stream:error 515
When WhatsApp sends stream:error code=515 (Connection Replaced), Baileys
handles the reconnect correctly and fires connection.update with state='open'.
However, WhatsApp then sends a 401 (loggedOut) to clean up the old session
slot, which Evolution API incorrectly treated as a real logout, killing the
newly-connected healthy instance.
The fix tracks when a stream:error 515 node arrives via the CB:stream:error
WebSocket event. If a loggedOut (401) close event fires within 30 seconds of
a 515, it is treated as a transient reconnect rather than a real logout.
Fixes #24981 parent cd800f2 commit b76325d
1 file changed
Lines changed: 11 additions & 1 deletion
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| |||
426 | 427 | | |
427 | 428 | | |
428 | 429 | | |
429 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
430 | 434 | | |
431 | 435 | | |
432 | 436 | | |
| |||
715 | 719 | | |
716 | 720 | | |
717 | 721 | | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
718 | 728 | | |
719 | 729 | | |
720 | 730 | | |
| |||
0 commit comments