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

Remove unnecesary sleep when submitting parallel tasks #9097

Merged
merged 2 commits into from Apr 17, 2021

Conversation

peterbell10
Copy link
Contributor

Feature or Bugfix

  • Refactoring

Purpose

ParallelTasks.add_task calls _join_one to poll for finished workers and possibly start the just-submitted task. However, it will also trigger the time.sleep call if no sub-processes are completed which unnecessarily slows down the launching of workers. Instead, I raise the time.sleep call into join so that add_task never starts a sleep.

The sleep is only 20 ms per task so this doesn't make a huge difference.

Copy link
Member

@tk0miya tk0miya left a comment

Choose a reason for hiding this comment

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

LGTM with nits.

sphinx/util/parallel.py Outdated Show resolved Hide resolved
@tk0miya
Copy link
Member

tk0miya commented Apr 17, 2021

Thank you for the quick update! Merging.

@tk0miya tk0miya changed the base branch from 3.x to 4.x April 17, 2021 12:53
@tk0miya tk0miya merged commit af53987 into sphinx-doc:4.x Apr 17, 2021
tk0miya added a commit that referenced this pull request Apr 17, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants