mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Give some more feedback that a configuration reload actually happens
This commit is contained in:
		
							parent
							
								
									304f22dc1d
								
							
						
					
					
						commit
						a6ae159329
					
				
					 1 changed files with 12 additions and 1 deletions
				
			
		| 
						 | 
					@ -125,11 +125,15 @@ func (c *Core) addPeerLoop() {
 | 
				
			||||||
// UpdateConfig updates the configuration in Core and then signals the
 | 
					// UpdateConfig updates the configuration in Core and then signals the
 | 
				
			||||||
// various module goroutines to reconfigure themselves if needed
 | 
					// various module goroutines to reconfigure themselves if needed
 | 
				
			||||||
func (c *Core) UpdateConfig(config *config.NodeConfig) {
 | 
					func (c *Core) UpdateConfig(config *config.NodeConfig) {
 | 
				
			||||||
 | 
						c.log.Infoln("Reloading configuration...")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c.configMutex.Lock()
 | 
						c.configMutex.Lock()
 | 
				
			||||||
	c.configOld = c.config
 | 
						c.configOld = c.config
 | 
				
			||||||
	c.config = *config
 | 
						c.config = *config
 | 
				
			||||||
	c.configMutex.Unlock()
 | 
						c.configMutex.Unlock()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						errors := 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	components := []chan chan error{
 | 
						components := []chan chan error{
 | 
				
			||||||
		c.admin.reconfigure,
 | 
							c.admin.reconfigure,
 | 
				
			||||||
		c.searches.reconfigure,
 | 
							c.searches.reconfigure,
 | 
				
			||||||
| 
						 | 
					@ -148,9 +152,16 @@ func (c *Core) UpdateConfig(config *config.NodeConfig) {
 | 
				
			||||||
		response := make(chan error)
 | 
							response := make(chan error)
 | 
				
			||||||
		component <- response
 | 
							component <- response
 | 
				
			||||||
		if err := <-response; err != nil {
 | 
							if err := <-response; err != nil {
 | 
				
			||||||
			c.log.Println(err)
 | 
								c.log.Errorln(err)
 | 
				
			||||||
 | 
								errors++
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if errors > 0 {
 | 
				
			||||||
 | 
							c.log.Warnln(errors, "modules reported errors during configuration reload")
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							c.log.Infoln("Configuration reloaded successfully")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetBuildName gets the current build name. This is usually injected if built
 | 
					// GetBuildName gets the current build name. This is usually injected if built
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue