chore: init fail open track
This commit is contained in:
35
server/tests/integration/queue/fixtures/livePollingWorker.ts
Normal file
35
server/tests/integration/queue/fixtures/livePollingWorker.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { SQSClient } from "@aws-sdk/client-sqs";
|
||||
import { startPollingLoop } from "@/queue/initWorkers.js";
|
||||
|
||||
const queueUrl = process.env.TEST_QUEUE_URL;
|
||||
const endpoint = process.env.TEST_SQS_ENDPOINT;
|
||||
const shouldPoll = process.env.TEST_SHOULD_POLL === "true";
|
||||
|
||||
if (!queueUrl || !endpoint) {
|
||||
throw new Error("TEST_QUEUE_URL and TEST_SQS_ENDPOINT are required");
|
||||
}
|
||||
|
||||
const createClient = () =>
|
||||
new SQSClient({
|
||||
region: "us-east-1",
|
||||
endpoint,
|
||||
credentials: {
|
||||
accessKeyId: "x",
|
||||
secretAccessKey: "x",
|
||||
},
|
||||
});
|
||||
|
||||
let client = createClient();
|
||||
|
||||
await startPollingLoop({
|
||||
db: {} as never,
|
||||
queueUrl,
|
||||
isFifo: queueUrl.endsWith(".fifo"),
|
||||
getSqsClientFn: () => client,
|
||||
recreateSqsClientFn: () => {
|
||||
client.destroy();
|
||||
client = createClient();
|
||||
return client;
|
||||
},
|
||||
shouldPoll: () => shouldPoll,
|
||||
});
|
||||
Reference in New Issue
Block a user