Use node-fetch for invokeEphemeralEvents instead of @whatwg-node/fetch (#734)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { PrismaClient, PrismaClientOrTransaction, prisma } from "~/db.server";
|
||||
import { taskOperationWorker } from "../worker.server";
|
||||
import { EphemeralDispatchableSchema } from "~/models/eventDispatcher.server";
|
||||
import { fetch } from "@whatwg-node/fetch";
|
||||
import { ExpireDispatcherService } from "./expireDispatcher.server";
|
||||
|
||||
export class InvokeEphemeralDispatcherService {
|
||||
@@ -61,23 +60,14 @@ export class InvokeEphemeralDispatcherService {
|
||||
accountId: eventRecord.externalAccount ? eventRecord.externalAccount.identifier : undefined,
|
||||
};
|
||||
|
||||
const abortController = new AbortController();
|
||||
|
||||
const timeoutId = setTimeout(() => {
|
||||
abortController.abort();
|
||||
}, 5000);
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
signal: abortController.signal,
|
||||
});
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`Failed to invoke ephemeral dispatcher: ${response.statusText} [${response.status}]`
|
||||
|
||||
Reference in New Issue
Block a user