Skip to content

Bug: Polling only activates single thread, should eagerly create additional threads when jobs exist#1148

Merged
bensheldon merged 1 commit intomainfrom
poll_fanout
Nov 14, 2023
Merged

Bug: Polling only activates single thread, should eagerly create additional threads when jobs exist#1148
bensheldon merged 1 commit intomainfrom
poll_fanout

Conversation

@bensheldon
Copy link
Copy Markdown
Owner

@bensheldon bensheldon commented Nov 10, 2023

I think this is a bug. When only using polling (e.g. #810's config.good_job.enable_listen_notify = false), only a single thread is ever active. This is because the Poller only ever activates a single thread, and then when a job is complete, it will only then activate the same thread again.

This PR changes that behavior: now, when the poller triggers a Scheduler to activate a thread to query for a job, and a job is found, a 2nd thread will be activated before performing the first job. If there are significant jobs, this should fan out until all available threads are used.

I am classifying this as a bug, though it only affects performance/throughput. It's possible that this may cause your GoodJob processes to use more resources if you are relying on polling alone.

fyi, @mitchellhenke

@bensheldon bensheldon added the bug Something isn't working label Nov 10, 2023
@bensheldon bensheldon force-pushed the poll_fanout branch 2 times, most recently from 415f0db to 249e19a Compare November 11, 2023 05:01
@bensheldon bensheldon marked this pull request as ready for review November 11, 2023 05:29
@bensheldon bensheldon merged commit e2f866b into main Nov 14, 2023
@bensheldon bensheldon deleted the poll_fanout branch November 14, 2023 14:32
@mitchellhenke
Copy link
Copy Markdown
Contributor

Thank you for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

2 participants