]> git.codecow.com Git - nano25519.git/commitdiff
Fix result listener.
authorChris Duncan <chris@codecow.com>
Fri, 14 Aug 2026 23:41:14 +0000 (16:41 -0700)
committerChris Duncan <chris@codecow.com>
Fri, 14 Aug 2026 23:41:14 +0000 (16:41 -0700)
src/lib/worker.ts

index 644f7d3c5020b2e8743a25495f90d903ef4a55f1..522d0a6923e07d6588a5adeedaa7bb54685cbcda 100644 (file)
@@ -162,14 +162,15 @@ function onresult (msg: { data: Record<string, unknown> }): void {
 
        const executor = tasks.get(data.id)
        if (executor == null) return
+       tasks.delete(data.id)
        const [ok, err] = executor
 
        const { result } = data
        console.log('received result from worker')
        if (typeof result !== 'boolean' && typeof result !== 'string' && !isBytes(result)) {
-               err('Invalid return type')
+               return err('Invalid return type')
        }
-       ok(result)
+       return ok(result)
 }
 
 // Check that the worker is running and listening before sending messages