Skip to content

Commit

Permalink
moved var into function scope
Browse files Browse the repository at this point in the history
  • Loading branch information
br41nslug committed May 10, 2024
1 parent 3ad0995 commit 86f7ed7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/composables/use-mutex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export function useMutex(key: MutexKey, expiresMs: number) {
const internalKey = `directus-mutex-${key}`;
const useWebLock = !!navigator.locks;

let retries = 0;

async function acquireMutex(callback: (lock?: Lock | null) => Promise<any>): Promise<any> {
if (useWebLock) {
return navigator.locks.request(internalKey, callback);
Expand All @@ -23,6 +21,8 @@ export function useMutex(key: MutexKey, expiresMs: number) {
}

async function localStorageLock(callback: (lock?: Lock | null) => Promise<any>) {
let retries = 0;

do {
const mutex = localStorage.getItem(internalKey);

Expand Down

0 comments on commit 86f7ed7

Please sign in to comment.