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
+3 -2
View File
@@ -24,10 +24,11 @@ import (
builder "github.com/fission/fission/pkg/builder"
"github.com/fission/fission/pkg/utils/httpserver"
"github.com/fission/fission/pkg/utils/manager"
)
// Usage: builder <shared volume path>
func Run(ctx context.Context, logger *zap.Logger, shareVolume string) {
func Run(ctx context.Context, logger *zap.Logger, mgr manager.Interface, shareVolume string) {
builder := builder.MakeBuilder(logger, shareVolume)
mux := http.NewServeMux()
mux.HandleFunc("/", builder.Handler)
@@ -35,5 +36,5 @@ func Run(ctx context.Context, logger *zap.Logger, shareVolume string) {
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
})
httpserver.StartServer(ctx, logger, "builder", "8001", mux)
httpserver.StartServer(ctx, logger, mgr, "builder", "8001", mux)
}