chore: format everything

This commit is contained in:
canove
2025-05-06 12:10:19 -03:00
parent 04afa20244
commit fa706d0b50
76 changed files with 8241 additions and 7142 deletions
+5 -5
View File
@@ -6,12 +6,12 @@ export const makeMutex = () => {
return {
mutex<T>(code: () => Promise<T> | T): Promise<T> {
task = (async() => {
task = (async () => {
// wait for the previous task to complete
// if there is an error, we swallow so as to not block the queue
try {
await task
} catch{ }
} catch {}
try {
// execute the current task
@@ -24,7 +24,7 @@ export const makeMutex = () => {
// we replace the existing task, appending the new piece of execution to it
// so the next task will have to wait for this one to finish
return task
},
}
}
}
@@ -35,11 +35,11 @@ export const makeKeyedMutex = () => {
return {
mutex<T>(key: string, task: () => Promise<T> | T): Promise<T> {
if(!map[key]) {
if (!map[key]) {
map[key] = makeMutex()
}
return map[key].mutex(task)
}
}
}
}