Skip to content

added manger to wait for go routines to finish #2869

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

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

vardhaman-surana
Copy link
Contributor

@vardhaman-surana vardhaman-surana commented Nov 7, 2023

Description

right now ctx.Done() is being used to ensure that we pass the cancellation signal to all the go routines but there is no mechanism to wait for the completion of all the running go routines.
This PR adds a manager which can be used to wait for go routines to be finished when context is cancelled.
manager's Add function can be used to start a go routine and then at the end when the context is cancelled manager's Wait function can be used to wait for the go routine to finish.

Which issue(s) this PR fixes:

Fixes #

Testing

Checklist:

  • I ran tests as well as code linting locally to verify my changes.
  • I have done manual verification of my changes, changes working as expected.
  • I have added new tests to cover my changes.
  • My changes follow contributing guidelines of Fission.
  • I have signed all of my commits.

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #2869 (10b7544) into main (2713297) will increase coverage by 0.14%.
The diff coverage is 54.90%.

@@            Coverage Diff             @@
##             main    #2869      +/-   ##
==========================================
+ Coverage   22.87%   23.02%   +0.14%     
==========================================
  Files          83       84       +1     
  Lines       10801    10834      +33     
==========================================
+ Hits         2471     2494      +23     
- Misses       8147     8156       +9     
- Partials      183      184       +1     
Flag Coverage Δ
unittests 23.02% <54.90%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
pkg/utils/httpserver/server.go 66.66% <100.00%> (ø)
pkg/utils/manager/manager.go 100.00% <100.00%> (ø)
pkg/utils/metrics/server.go 0.00% <0.00%> (ø)
pkg/mqtrigger/mqtmanager.go 38.88% <0.00%> (-0.63%) ⬇️
pkg/router/router.go 0.00% <0.00%> (ø)
pkg/storagesvc/storagesvc.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

renamed Manafer to Interface and GoRoutineManager to GroupManager

replaced some go routine calls with manager Add func
@vardhaman-surana vardhaman-surana changed the title added manager to wait for all go routines to end before exit added manger to gracefully shutdown services Nov 7, 2023
@vardhaman-surana vardhaman-surana changed the title added manger to gracefully shutdown services added manger to keep track of go routines in the services Nov 7, 2023
@vardhaman-surana vardhaman-surana changed the title added manger to keep track of go routines in the services added manger to wait for go routines to finish Nov 7, 2023
@sanketsudake sanketsudake merged commit 2a40b45 into fission:main Nov 7, 2023
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