mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-20 05:18:06 +02:00
removing inner goroutine in cluster.Switchover (#1876)
* removing inner goroutine in cluster.Switchover and resolve race between processPodEvent and unregisterPodSubscriber * unlock mutex after handling event, now with non-blocking default case
This commit is contained in:
+2
-2
@@ -316,7 +316,7 @@ func (c *Cluster) annotationsSet(annotations map[string]string) map[string]strin
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) waitForPodLabel(podEvents chan PodEvent, stopChan chan struct{}, role *PostgresRole) (*v1.Pod, error) {
|
||||
func (c *Cluster) waitForPodLabel(podEvents chan PodEvent, stopCh chan struct{}, role *PostgresRole) (*v1.Pod, error) {
|
||||
timeout := time.After(c.OpConfig.PodLabelWaitTimeout)
|
||||
for {
|
||||
select {
|
||||
@@ -332,7 +332,7 @@ func (c *Cluster) waitForPodLabel(podEvents chan PodEvent, stopChan chan struct{
|
||||
}
|
||||
case <-timeout:
|
||||
return nil, fmt.Errorf("pod label wait timeout")
|
||||
case <-stopChan:
|
||||
case <-stopCh:
|
||||
return nil, fmt.Errorf("pod label wait cancelled")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user