Skip to content

Support passing a AbortSignal to cache.match #1505

Open
@SamyPesse

Description

@SamyPesse

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequest for Workers team to add a feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions