Worker waitUntil question

I have a worker that I want to call an external api on, but I want to return a response without awaiting the the external api call. (the external api call is to just save time writing to the db on another service).

        const promise = fetch('http://localhost:3000/impression', {
            method: "POST",
            body: JSON.stringify(data),
            headers: {
                "content-type": "application/json",
            }
        });
        c.executionCtx.waitUntil(promise.then())

        flow.params = { campaignId: campaignId }
        return flow;
Was this page helpful?