Commit 54981d4
⚡ Bolt: Parallelize session destruction in Node.js SDK
Optimized the `stop()` method in `CopilotClient` to destroy all active
sessions in parallel using `Promise.all`.
Previously, sessions were destroyed sequentially, leading to a linear
increase in shutdown time as the number of sessions grew. With this
change, the total time for session destruction is approximately the
duration of the slowest individual destruction.
Measurements:
- 10 sessions with 100ms destruction delay:
- Before: ~1000ms
- After: ~100ms
- Performance gain: ~10x for 10 sessions.
The individual retry logic and exponential backoff for each session
are preserved. All failures are still collected and reported.
Co-authored-by: AkCodes23 <135016848+AkCodes23@users.noreply.github.com>1 parent 7a3dcf3 commit 54981d4
2 files changed
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
| 256 | + | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 279 | + | |
| 280 | + | |
283 | 281 | | |
284 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
285 | 291 | | |
286 | 292 | | |
287 | 293 | | |
| |||
0 commit comments