mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-04 08:04:37 +08:00
The sweep and the dispatch loop's pending check walked every registered socket on each loop pass, so a server with many keep-alive connections paid for all of them on every request. A socket now joins a work queue when it may have deferred work (bytes buffered for a consumer, write callbacks waiting for the drain, 'finish', an error or 'close') and leaves it when a sweep visit leaves it none. The queue is ordered by registration, so the sweep visits sockets in registry order as before. With SCR_RC_AUDIT, the dispatch loop checks that no registered socket outside the queue has deferred work.