added manger to keep track of go routines in the services (#2869)

- added manager to wait for all go routines to end before exit
- code refactor
- renamed Manafer to Interface and GoRoutineManager to GroupManager
- replaced some go routine calls with manager Add func
- added unit tests for manager
This commit is contained in:
Vardhaman Surana
2023-11-07 15:30:48 +05:30
committed by GitHub
parent 27132975c4
commit 2a40b4538c
24 changed files with 283 additions and 67 deletions
+8 -2
View File
@@ -24,15 +24,21 @@ import (
"github.com/fission/fission/cmd/builder/app"
"github.com/fission/fission/pkg/utils/loggerfactory"
"github.com/fission/fission/pkg/utils/manager"
"github.com/fission/fission/pkg/utils/profile"
)
// Usage: builder <shared volume path>
func main() {
mgr := manager.New()
defer mgr.Wait()
logger := loggerfactory.GetLogger()
defer logger.Sync()
ctx := signals.SetupSignalHandler()
profile.ProfileIfEnabled(ctx, logger)
profile.ProfileIfEnabled(ctx, logger, mgr)
shareVolume := os.Args[1]
if _, err := os.Stat(shareVolume); err != nil {
if os.IsNotExist(err) {
@@ -42,5 +48,5 @@ func main() {
}
}
}
app.Run(ctx, logger, shareVolume)
app.Run(ctx, logger, mgr, shareVolume)
}