mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-26 18:31:34 +01:00
Stabilize CI cleanup tests
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
ed97b4130e
commit
be72ddc7d6
2 files changed
+9
-1
No files matched your search
@@ -42,7 +42,7 @@ afterEach(async () => {
|
||||
const cleanup = cleanups.pop();
|
||||
await cleanup?.();
|
||||
}
|
||||
});
|
||||
}, 60_000);
|
||||
|
||||
if (!embeddedPostgresSupport.supported) {
|
||||
console.warn(
|
||||
|
||||
@@ -68,6 +68,11 @@ async function waitFor(condition: () => boolean | Promise<boolean>, timeoutMs =
|
||||
throw new Error("Timed out waiting for condition");
|
||||
}
|
||||
|
||||
function isHeartbeatRunEventFkError(error: unknown) {
|
||||
const message = error instanceof Error ? `${error.message} ${String(error.cause ?? "")}` : String(error);
|
||||
return message.includes("heartbeat_run_events_run_id_heartbeat_runs_id_fk");
|
||||
}
|
||||
|
||||
async function deleteHeartbeatRunsAndWakeupsAfterActivityLogDrains(db: Db) {
|
||||
let lastError: unknown = null;
|
||||
for (let attempt = 0; attempt < 10; attempt += 1) {
|
||||
@@ -80,6 +85,9 @@ async function deleteHeartbeatRunsAndWakeupsAfterActivityLogDrains(db: Db) {
|
||||
return;
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
if (!isHeartbeatRunEventFkError(error)) {
|
||||
throw error;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 25));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user