chore: clean up test scripts and sync payload CRM collections
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 11s
Build & Deploy / 🧪 QA (push) Failing after 23s
Build & Deploy / 🏗️ Build (push) Failing after 27s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🩺 Health Check (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 5s

This commit is contained in:
2026-02-27 18:41:48 +01:00
parent 8907963d57
commit 4b5609a75e
15 changed files with 4301 additions and 106 deletions

View File

@@ -9,7 +9,34 @@ const __dirname = path.dirname(__filename);
async function run() {
try {
const payload = await getPayload({ config: configPromise });
let payload;
let retries = 5;
while (retries > 0) {
try {
payload = await getPayload({ config: configPromise });
break;
} catch (e: any) {
if (
e.code === "ECONNREFUSED" ||
e.message?.includes("ECONNREFUSED") ||
e.message?.includes("cannot connect to Postgres")
) {
console.log(
`Database not ready, retrying in 2 seconds... (${retries} retries left)`,
);
retries--;
await new Promise((res) => setTimeout(res, 2000));
} else {
throw e;
}
}
}
if (!payload) {
throw new Error(
"Failed to connect to the database after multiple retries.",
);
}
const existing = await payload.find({
collection: "context-files",