diff --git a/lib/ThroatQueueFunction.js b/lib/ThroatQueueFunction.js index 986ff67..cb68f3f 100644 --- a/lib/ThroatQueueFunction.js +++ b/lib/ThroatQueueFunction.js @@ -8,7 +8,11 @@ function ThroatQueueFunction(n = 5){ const deferred = Q.defer() cancellationState.deferredWrap(deferred) running = [...running, deferred.promise] - await Q.safeRace(running) + try { + await Q.safeRace(running) + } finally { + deferred.resolve(null) + } } let ret = async function(cancellationState, what){ if(what === null){