cloudflare / cloudflare/workerd

Feature request: API mechanism to await RequestContext death

Open
#411 3 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

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

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.