Commit d803c9f
committed
fix(baileys): name the 515 reconnect grace + tighten stream-error types
Addresses sourcery-ai review feedback on the previous commit:
- Extract the 30 000ms reconnect grace window into a named class constant
STREAM_515_RECONNECT_GRACE_MS so future tuning is self-documenting
rather than a literal scattered through the close handler.
- Extract the magic '515' string into STREAM_ERROR_CODE_RECONNECT.
- Replace the loose 'node: any' on the 'CB:stream:error' handler with a
minimal structural type ({ attrs?: { code?: string | number } }) so
the payload shape is documented and type-checked.
- Compare the code via String(...) so a numeric 515 from the underlying
socket library still triggers the grace window — the original literal
'515' check would have silently broken on a type change.1 parent b76325d commit d803c9f
1 file changed
Lines changed: 11 additions & 3 deletions
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
260 | 267 | | |
261 | 268 | | |
262 | 269 | | |
| |||
427 | 434 | | |
428 | 435 | | |
429 | 436 | | |
430 | | - | |
| 437 | + | |
| 438 | + | |
431 | 439 | | |
432 | 440 | | |
433 | 441 | | |
| |||
719 | 727 | | |
720 | 728 | | |
721 | 729 | | |
722 | | - | |
723 | | - | |
| 730 | + | |
| 731 | + | |
724 | 732 | | |
725 | 733 | | |
726 | 734 | | |
| |||
0 commit comments