cloudflare / cloudflare/workerd

Support passing a AbortSignal to cache.match

Open
#1,505 2 comments 1 reaction 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

Because of how Cloudflare is tracing async executions (https://zuplo.com/blog/2022/03/04/the-script-will-never-generate-a-response), when implementing concurrent logic with `Promise.race` or similar, it's prefered to use a signal to abort any underlying fetch.

For example in my case I want to read from multiple caches in parallel, and one of them is the `caches.default`. But in theory the script might respond before all the caches finished responding.

It'd be great if we could pass a `AbortSignal` to `cache.match`:

```ts
const abort = new AbortController();
const response = await cache.match(request, { signal: abort.signal });
```

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.