mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-07 09:21:53 +02:00
Fix graceful shutdown
graceful shutdown of goroutines on operator exit
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
@@ -97,7 +99,9 @@ func (c *Controller) podDelete(obj interface{}) {
|
||||
c.podCh <- podEvent
|
||||
}
|
||||
|
||||
func (c *Controller) podEventsDispatcher(stopCh <-chan struct{}) {
|
||||
func (c *Controller) podEventsDispatcher(stopCh <-chan struct{}, wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
c.logger.Debugln("Watching all pod events")
|
||||
for {
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user