delete cluster key from the clusters list only when delete procedure is finished
This commit is contained in:
		
							parent
							
								
									39c123e96a
								
							
						
					
					
						commit
						4db5bd13d1
					
				|  | @ -200,6 +200,11 @@ func (c *Controller) processEvent(event spec.ClusterEvent) { | ||||||
| 		lg.Infoln("deletion of the cluster started") | 		lg.Infoln("deletion of the cluster started") | ||||||
| 
 | 
 | ||||||
| 		teamName := strings.ToLower(cl.Spec.TeamID) | 		teamName := strings.ToLower(cl.Spec.TeamID) | ||||||
|  | 
 | ||||||
|  | 		if err := cl.Delete(); err != nil { | ||||||
|  | 			lg.Errorf("could not delete cluster: %v", err) | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		func() { | 		func() { | ||||||
| 			defer c.clustersMu.Unlock() | 			defer c.clustersMu.Unlock() | ||||||
| 			c.clustersMu.Lock() | 			c.clustersMu.Lock() | ||||||
|  | @ -216,11 +221,6 @@ func (c *Controller) processEvent(event spec.ClusterEvent) { | ||||||
| 			} | 			} | ||||||
| 		}() | 		}() | ||||||
| 
 | 
 | ||||||
| 		if err := cl.Delete(); err != nil { |  | ||||||
| 			lg.Errorf("could not delete cluster: %v", err) |  | ||||||
| 			return |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		lg.Infof("cluster has been deleted") | 		lg.Infof("cluster has been deleted") | ||||||
| 	case spec.EventSync: | 	case spec.EventSync: | ||||||
| 		lg.Infof("syncing of the cluster started") | 		lg.Infof("syncing of the cluster started") | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue