Skip to content

parallel scheduler bugfixes: shutdown, worker counts #1081

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

James-Gilbert-
Copy link
Contributor

What

  • Adds panic recovery for the developer-supplied do function
  • Updates workersActive gauge when a worker exits
  • Ensures that at least one worker is always started by NewScheduler()

Why

  • Shutdown() relies on a fixed number of workers signaling via p.out. If fewer workers are available to signal, it can hang.
  • More accurate metrics, prevents the silent loss of a worker if a task panics

Alternatives

  • Immediately stop worker, clean up resources, and signal after recovering from a panic
  • Use a sync.WaitGroup to track active workers, and manage lifecyle via context propagation
    • Maybe derive a taskCtx with timeout to mitigate head-of-line blocking in place of context.TODO()

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.

1 participant