chore: init fail open track

This commit is contained in:
Charlie Lamb
2026-04-24 16:40:36 +01:00
parent 92ed528787
commit d7e4af787a
27 changed files with 1348 additions and 82 deletions

View 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,
});