cloudflare / cloudflare/workerd
Feature request: API mechanism to await RequestContext death
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
https://github.com/cloudflare/workerd/issues/5258 has more details, but TLDR when writing tests against Miniflare, I'm finding myself needing to know when all associated waitUntil with a request I generated is done (or at least awaiting when there's no more request contexts running). Example test cases this would enable:
* Asserting logs, sentry messages, and metrics that are put into waitUntil are actually getting emitted correctly
* Asserting background actions are complete.
There are some ways of simulating it with application code without any miniflare/workerd support but it results in very brittle tests and requires calling alternate `waitUntil` magic within the Worker code which means it doesn't play nice with tools that call the normal waitUntil (e.g. ToucanJS).
Having it be per request is the most flexible but my hunch is that it's easier to be done process-wide.
Contributor guide
Assessment
This issue has not been assessed yet.