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

Job service #255

Merged
merged 5 commits into from
Nov 1, 2023
Merged

Job service #255

merged 5 commits into from
Nov 1, 2023

Conversation

adam-fowler
Copy link
Member

Restructure Job handlers to use TaskGroup and conform to ServiceLifecycle Service

@adam-fowler adam-fowler marked this pull request as draft October 29, 2023 11:03
@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Files Coverage Δ
Sources/HummingbirdJobs/Job.swift 77.14% <ø> (+77.14%) ⬆️
Sources/HummingbirdJobs/JobInstance.swift 100.00% <100.00%> (ø)
Sources/HummingbirdJobs/JobQueueHandler.swift 100.00% <100.00%> (+100.00%) ⬆️
Sources/HummingbirdJobs/MemoryJobQueue.swift 98.57% <100.00%> (+98.57%) ⬆️
Sources/HummingbirdJobs/JobQueueError.swift 80.00% <0.00%> (+80.00%) ⬆️
Sources/HummingbirdJobs/JobIdentifier.swift 80.00% <80.00%> (ø)

... and 8 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

@adam-fowler adam-fowler marked this pull request as ready for review October 31, 2023 10:54
@adam-fowler adam-fowler requested a review from Joannis October 31, 2023 10:54
Copy link
Member

@Joannis Joannis left a comment

Choose a reason for hiding this comment

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

Just one comment

$0.start()
public func run() async throws {
try await withGracefulShutdownHandler {
try await withThrowingTaskGroup(of: Void.self) { group in
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a discarding task group?

Copy link
Member Author

Choose a reason for hiding this comment

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

A discarding task group doesn't give you any info on when a child task has finished. So I have no way to control how many tasks are running. I think a normal task group is ok as long as you are calling next() as that'll drop finished tasks off the list. I will need to check that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Going to merge this and revisit the usage to withTaskGroup

@adam-fowler adam-fowler merged commit 622b8f0 into 2.x.x Nov 1, 2023
7 checks passed
@adam-fowler adam-fowler deleted the job-service branch November 1, 2023 15:06
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