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

feat(taskgroup): wait for ongoing tasks complete when group is stopped or context is cancelled #82

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

alitto
Copy link
Owner

@alitto alitto commented Nov 10, 2024

This pull request includes multiple changes to improve the task group functionalities and their associated tests in the pond package. The most important changes include updating the Wait method behavior, adding context support to task groups, and enhancing test cases to cover new scenarios.

Enhancements to Task Group Functionality:

  • Allow running tasks to complete if a group is stopped or its context is cancelled.
  • Return result values of tasks that have completed instead of an empty slice when a group is stopped, its context is cancelled or one of the tasks returns an error.
  • Added detailed comments to the Wait methods in TaskGroup and ResultTaskGroup interfaces to clarify the behavior when tasks return errors, the context is canceled, or the group is stopped.
  • Added NewGroupContext method to ResultPool to create task groups with a specified context.
  • Improved the CompositeFuture to handle context cancellation and error resolution more effectively.

Test Case Improvements:

  • Updated test cases to validate the new Wait method behavior, including scenarios with errors, context cancellation, and multiple errors.
  • Enhanced CompositeFuture test cases to ensure proper handling of errors and context cancellation.

Minor Fixes:

  • Updated Makefile to run tests recursively.
  • Fixed variable initialization in TestDispatcherWithContextCanceledAfterWrite test.

Copy link

codecov bot commented Nov 10, 2024

Codecov Report

Attention: Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.52%. Comparing base (11ecf70) to head (9417292).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/future/composite.go 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
- Coverage   95.59%   95.52%   -0.07%     
==========================================
  Files           8       14       +6     
  Lines         431      827     +396     
==========================================
+ Hits          412      790     +378     
- Misses         17       33      +16     
- Partials        2        4       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alitto alitto merged commit f1d2a44 into main Nov 10, 2024
9 checks passed
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