cloudflare / cloudflare/workerd

Question about the behavior of `AbortSignal`

Open
#4,936 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

When using `AbortSignal.timeout(ms)`, the worker stays up for the duration of the timeout (the `request_context` stays up for that long). The reported wall time will always be greater than the timeout.

Could it cause side effect if the Worker stays up for too long?

If it can cause side effect
- would there be an automatic way to abort the signal when there is no async work going on?
- if there is no automatic, would it better to instantiate an `AbortController` and call `abort` in a `setTimeout()` and when we know that the signal will not be needed any more?

/cc @danlapid @jasnell

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.