Commit 22dad97
Handle NaN/Infinity in flushBatch; add NaN regression test
Per CodeRabbit's follow-up finding: the `<= 0` guard in flushBatch
caught the mid-flight 0 case, but not NaN. `NaN <= 0` is false, so
a NaN batch size would fall through to `splice(0, NaN)`, which
coerces to `splice(0, 0)` — reinstating the exact infinite
reschedule loop we were trying to prevent.
Switch to `Math.trunc` + `Number.isFinite` so any non-positive or
non-finite value routes through `flushAll`. Added a regression
test covering the NaN case.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 200f8ae commit 22dad97
2 files changed
Lines changed: 17 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | 105 | | |
107 | 106 | | |
108 | | - | |
109 | | - | |
110 | 107 | | |
111 | 108 | | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
115 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
116 | 124 | | |
117 | 125 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
0 commit comments