wait after restart outside of function
This commit is contained in:
		
							parent
							
								
									d1edb11041
								
							
						
					
					
						commit
						d13b02d6ed
					
				|  | @ -505,6 +505,7 @@ func TestCloneEnv(t *testing.T) { | ||||||
| 	var cluster = New( | 	var cluster = New( | ||||||
| 		Config{ | 		Config{ | ||||||
| 			OpConfig: config.Config{ | 			OpConfig: config.Config{ | ||||||
|  | 				AWSRegion:      "test-region", | ||||||
| 				WALES3Bucket:   "wale-bucket", | 				WALES3Bucket:   "wale-bucket", | ||||||
| 				ProtectedRoles: []string{"admin"}, | 				ProtectedRoles: []string{"admin"}, | ||||||
| 				Auth: config.Auth{ | 				Auth: config.Auth{ | ||||||
|  |  | ||||||
|  | @ -422,11 +422,12 @@ func (c *Cluster) syncStatefulSet() error { | ||||||
| 				masterPod = &pods[i] | 				masterPod = &pods[i] | ||||||
| 				continue | 				continue | ||||||
| 			} | 			} | ||||||
| 			c.restartInstance(&pod, ttl) | 			c.restartInstance(&pod) | ||||||
|  | 			time.Sleep(time.Duration(ttl) * time.Second) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if masterPod != nil { | 		if masterPod != nil { | ||||||
| 			c.restartInstance(masterPod, ttl) | 			c.restartInstance(masterPod) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -443,7 +444,7 @@ func (c *Cluster) syncStatefulSet() error { | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Cluster) restartInstance(pod *v1.Pod, ttl int32) { | func (c *Cluster) restartInstance(pod *v1.Pod) { | ||||||
| 	podName := util.NameFromMeta(pod.ObjectMeta) | 	podName := util.NameFromMeta(pod.ObjectMeta) | ||||||
| 	role := PostgresRole(pod.Labels[c.OpConfig.PodRoleLabel]) | 	role := PostgresRole(pod.Labels[c.OpConfig.PodRoleLabel]) | ||||||
| 
 | 
 | ||||||
|  | @ -454,7 +455,6 @@ func (c *Cluster) restartInstance(pod *v1.Pod, ttl int32) { | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	time.Sleep(time.Duration(ttl) * time.Second) |  | ||||||
| 	c.logger.Debugf("Postgres server successfuly restarted in %s pod %s", role, podName) | 	c.logger.Debugf("Postgres server successfuly restarted in %s pod %s", role, podName) | ||||||
| 	c.eventRecorder.Event(c.GetReference(), v1.EventTypeNormal, "Update", fmt.Sprintf("Postgres server restart done for %s pod %s", role, pod.Name)) | 	c.eventRecorder.Event(c.GetReference(), v1.EventTypeNormal, "Update", fmt.Sprintf("Postgres server restart done for %s pod %s", role, pod.Name)) | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue