Skip to content

Address wait timeout limits in job repository #93

Description

@adeutscher

Ever since its inception, some methods in JobRepository have used event WaitAsync calls with timeouts to mitigate the possibility of a race condition leaving events uncaught. They are set in loops with a 250ms timeout whose exit conditions check the data that the awaited event implies a state for. This is functional and it prevents CPU pinning as intended, but it could surely be better.

This issue marks an official effort to address that.

Pain points in JobRepository:

  • WaitForEmptyRepositoryAsync waits for _repositoryEmptyEvent. The setting of this this event implies that the number of watched jobs is zero.
  • GetNextJobAsync waits for _jobsAvailableEvent if there is currently no next job. The setting of this implies that the number of available jobs is non-zero.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions