Skip to content

refactor: replace ext/web timer imports with core timers or node:timers#33121

Open
bartlomieju wants to merge 3 commits intomainfrom
refactor/use-core-timers
Open

refactor: replace ext/web timer imports with core timers or node:timers#33121
bartlomieju wants to merge 3 commits intomainfrom
refactor/use-core-timers

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

  • ext/node polyfills (http.ts, pipe_wrap.ts, _util/async.ts): import setTimeout/clearTimeout from node:timers instead of ext:deno_web/02_timers.js
  • ext/websocket (01_websocket.js): use core.createTimer/core.cancelTimer directly for idle timeout management
  • ext/fetch (27_eventsource.js): use core.createTimer/core.cancelTimer directly for SSE reconnection
  • runtime (99_main.js): use core.createTimer for the exit delay timer
  • Remove unused webClearTimeout/timerId imports from http.ts
  • Remove unused FunctionPrototypeCall from 99_main.js

Follow-up to #33118 -- now that Node.js timers are the default, ext/node polyfills should use them directly, and internal Deno plumbing should use core timers instead of the web timer wrappers.

Test plan

  • ./x test-unit timers passes
  • Smoke test: setTimeout/clearTimeout work correctly
  • Full CI

🤖 Generated with Claude Code

bartlomieju and others added 3 commits April 1, 2026 20:27
- ext/node polyfills: use node:timers directly instead of going through
  ext:deno_web/02_timers.js
- ext/websocket, ext/fetch, runtime: use core.createTimer/cancelTimer
  directly instead of the web timer wrappers
- Remove unused webClearTimeout and timerId imports from http.ts
- Remove unused FunctionPrototypeCall from 99_main.js

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
core.cancelTimer crashes on null unlike web clearTimeout which was
a no-op. Add null guards at all call sites. Also remove the stale
clearTimeout(this._timeout[timerId]) line from http.ts and the now
unused clearTimeout import.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
System timers (isSystem=true) are excluded from the ops sanitizer's
timer leak detection. WebSocket idle timeout, EventSource reconnection,
and the window.close exit timer are all internal system timers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant