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;
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;
1 Reply
rob
rob7mo ago
yea trying to figure out if there's another way to do this
Want results from more Discord servers?
Add your server