better code
Massimo Melina committed
Apr 19, 2025 at 16:21 UTC
66bdb54fa2585ffaa6a96861047afdd2917f1c66
2 files changed
+3
-3
src/cross.ts
+2
-2
@@ -361,10 +361,10 @@ export async function asyncGeneratorToArray<T>(generator: AsyncIterable<T>): Pro
361
362
export function repeat(everyMs: number, cb: Callback<Callback>): Callback {
363
let stop = false
364
- setTimeout(async () => {
364
+ ;(async () => {
365
while (!stop && await Promise.allSettled([cb(stopIt)]))
366
await wait(everyMs)
367
- })
367
+ })()
368
return stopIt
369
function stopIt() {
370
stop = true
src/upload.ts
+1
-1
@@ -118,7 +118,7 @@ export function uploadWriter(base: VfsNode, baseUri: string, path: string, ctx:
118
if (ctx.query.existing === 'skip' && fs.existsSync(fullPath))
119
return fail(HTTP_CONFLICT, 'exists')
120
if (uploadingFiles.has(fullPath))
121
- return fail(HTTP_CONFLICT, 'uploading')
121
+ return fail(HTTP_CONFLICT, 'already uploading')
122
uploadingFiles.add(fullPath)
123
let overwriteRequestedButForbidden = false
124
try {