Utilize locks to prevent certain edge case issues
This commit is contained in:
1 parent
f4596db9f7
commit
342210faf1
7 files changed
+323
-269
No files matched your search
+2
-2
@@ -44,7 +44,7 @@ export async function releaseLock(
|
||||
if (res.deletedCount !== 1) throw new Error("Lock expired");
|
||||
}
|
||||
|
||||
export async function lockExists(lockName: string): Promise<boolean> {
|
||||
export async function getToken(lockName: string): Promise<string> {
|
||||
const res = await collections.locks.findOne({ _id: lockName });
|
||||
return res != null;
|
||||
return res?.value;
|
||||
}
|
||||
Reference in new issue
Block a user