tony
tony
Explore posts from servers
HHono
Created by tony on 4/30/2024 in #help
executionCtx.waitUntil on write service
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;
however when I am testing it local and it is not hitting the service I am using hono https://hono.dev/api/context#executionctx the worker is on localhost:8787 and the write service for the impression is on localhost:3000 I am able to create the impression successfully calling it directly but the waitUntil is not hitting localhost:3000 when calling the localhost:8787 endpoint
1 replies