Add informers and internal go routines in manager (#2870)

* used manager's Add function in more places
* exit when ctx.Done is received in archivePruner go routines
* fix manager tests
* fix data race
* added more gpm function in manager and removed manager from a util function
* closed unused channel and stopped ticker after context is done
* added log statements
* used context.Done inside function instead of stopper channel
This commit is contained in:
Vardhaman Surana
2023-11-10 12:42:21 +05:30
committed by GitHub
parent 2a40b4538c
commit 3fabf64b3c
28 changed files with 195 additions and 114 deletions
+3 -4
View File
@@ -39,6 +39,7 @@ import (
fetcherConfig "github.com/fission/fission/pkg/fetcher/config"
"github.com/fission/fission/pkg/generated/clientset/versioned"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
)
const (
@@ -131,10 +132,8 @@ func (envw *environmentWatcher) getLabels(envName string, envNamespace string, e
}
}
func (envw *environmentWatcher) Run(ctx context.Context) {
for _, informer := range envw.envWatchInformer {
go informer.Run(ctx.Done())
}
func (envw *environmentWatcher) Run(ctx context.Context, mgr manager.Interface) {
mgr.AddInformers(ctx, envw.envWatchInformer)
}
func (envw *environmentWatcher) EnvWatchEventHandlers(ctx context.Context) error {