cloudflare / cloudflare/workerd
Feature request for Miniflare 3: Ability to wait for request context death
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
It can be useful to write tests where you assert certain behavior after you know that all waitUntil tasks have completed (e.g. you want to assert background logs were generated correctly). To do so, there needs to be some mechanism between workerd and Miniflare to enable this.
Option 1: Per-request await. There's some API that lets you know when the request context for a given response has died (e.g. maybe an extra parameter in the cf object like `resp.cf.requestContextDeath`?
Option 2: Wait for all request contexts to be dead within workerd.
Option 1 is the most flexible and let's you write very precise tests (option 2 can be implemented in terms of option 1 without extra workerd machinery).
Option 2 is probably a good enough MVP to enable all interesting tests and might be the more palatable option from the workerd perspective (not 100% sure).
Contributor guide
Assessment
This issue has not been assessed yet.