fix: prevent duplicate uploads and group asset commits
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const activeUploads = new Set<string>()
|
||||
|
||||
function buildKey(folderName: string) {
|
||||
return folderName.toLowerCase()
|
||||
}
|
||||
|
||||
export function acquireUploadLock(folderName: string): boolean {
|
||||
const key = buildKey(folderName)
|
||||
if (activeUploads.has(key)) return false
|
||||
activeUploads.add(key)
|
||||
return true
|
||||
}
|
||||
|
||||
export function releaseUploadLock(folderName: string) {
|
||||
activeUploads.delete(buildKey(folderName))
|
||||
}
|
||||
Reference in New Issue
Block a user