Commit b525afe
docs(components): scope shutdown cleanup to what needs an explicit hook
Address review feedback on the new shutdown cleanup coverage.
The section listed timers and open connections as things an application
is responsible for tearing down. Node closes timers and sockets itself
when a thread exits, so presenting them as the app's job is misleading.
Reframe both the plugin-api.md section and the applications.md pointer
around work that genuinely needs a hook: flushing buffered writes,
deregistering from an external service, releasing a distributed lock,
or closing a connection whose remote side expects a graceful goodbye.
Also drop the incorrect justification for `scope.once()`. It claimed
`once` avoids leaving a listener behind during a reload, but
`Scope.close()` detaches its `'close'` listeners as part of closing and
a reload builds a new Scope, so `on()` cannot strand a listener on a
closed scope either. Recommend `once()` on the honest grounds that
closing is a one-time lifecycle event.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 5c7acbd commit b525afe
2 files changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | | - | |
| 401 | + | |
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
| |||
0 commit comments