Skip to content

Commit 9728d80

Browse files
authored
fix: db transaction errors caused by checkDocumentLockStatus (#11287)
Just like #11269, we stop passing through `req` to db operations in `checkDocumentLockStatus`. After extensive testing, this seems to get rid of all transaction errors that occurred when I was testing autosave against a remote mongo DB. We keep the `req` for postgres, as it mysteriously breaks in CI - this cannot be reproduced locally
1 parent 0594701 commit 9728d80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/payload/src/utilities/checkDocumentLockStatus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export const checkDocumentLockStatus = async ({
6363
collection: 'payload-locked-documents',
6464
limit: 1,
6565
pagination: false,
66-
req,
6766
sort: '-updatedAt',
6867
where: lockedDocumentQuery,
6968
})
@@ -93,7 +92,8 @@ export const checkDocumentLockStatus = async ({
9392
// Perform the delete operation regardless of overrideLock status
9493
await payload.db.deleteMany({
9594
collection: 'payload-locked-documents',
96-
req, //
95+
// Not passing req fails on postgres
96+
req: payload.db.name === 'mongoose' ? undefined : req,
9797
where: lockedDocumentQuery,
9898
})
9999
}

0 commit comments

Comments
 (0)