Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(isolate): do not trigger avaliable event when isolated #11

Merged
merged 1 commit into from
Dec 24, 2021

Conversation

antfu
Copy link
Collaborator

@antfu antfu commented Dec 24, 2021

This only happens on massive concurrency. Unblocks vueuse/vueuse#1092 and vitest-dev/vitest#295

const { taskId, result } = message
// In case of success: Call the callback that was passed to `runTask`,
// remove the `TaskInfo` associated with the Worker, which marks it as
// free again.
const taskInfo = workerInfo.taskInfos.get(taskId)
workerInfo.taskInfos.delete(taskId)

pool.workers.maybeAvailable(workerInfo)
if (!this.options.isolateWorkers) pool.workers.maybeAvailable(workerInfo)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only line changed. The others are dum diff of moving a function to top

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this seems reasonable.

@Aslemammad Aslemammad merged commit 5cb49d3 into tinylibs:main Dec 24, 2021
@antfu antfu deleted the fix/isolate-avaliable branch December 24, 2021 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants