Closed andrewcourtice closed 2 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/andrewcourtice/harlem/DcY3TBHMALVQZaSeoLGx57gVircW
✅ Preview: https://harlem-git-fix-task-abort-resolution-andrewcourtice.vercel.app
This fixes an issue with the
Task
where subsequentonAbort
handlers are interrupted if a preceding handler finalises the underlying promise. This could lead to memory leaks if cleanup tasks are being handled in theonAbort
callback after the task resolution.Calling
resolve
/reject
inside theonAbort
handler now defers the resolution until allonAbort
handlers have been called. TheTask
only accepts the outcome of the first handler to callresolve
/reject
- subsequent calls toresolve
/reject
will have no affect on theTask
outcome.