mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-06 07:38:47 +01:00
Observe the actual join retention row lock before releasing its writer
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
ff8e456b68
commit
405c7dcdef
1 file changed
+8
-1
@@ -277,7 +277,14 @@ const delay = DEFAULT_DECISION_ARCHIVE_DAYS * 86_400_000;
|
||||
await writeJoinRequestChange(tx as unknown as Db, owner => owner.update(joinRequests).set({ updatedAt: new Date() }).where(eq(joinRequests.id, row.id)));
|
||||
});
|
||||
await admitted; const sweep = joinRequestRetentionService(db).sweep();
|
||||
await vi.advanceTimersByTimeAsync(100); release(); await write; await sweep;
|
||||
try {
|
||||
await vi.waitFor(async () => {
|
||||
const [row] = await db.execute(sql`select count(*)::int as waiting from pg_stat_activity
|
||||
where datname = current_database() and pid <> pg_backend_pid() and wait_event_type = 'Lock'
|
||||
and query like 'select%' and query like '%from "join_requests"%'`);
|
||||
expect(row.waiting).toBe(1);
|
||||
});
|
||||
} finally { release(); await write; await sweep; }
|
||||
expect(await state(row.id)).toBeNull();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user