Fix race condition of trying to write YAML config simultaneously and failing.
This commit is contained in:
parent
942cde79bd
commit
2012e707d0
|
@ -172,6 +172,8 @@ func parseConfig() error {
|
||||||
|
|
||||||
// Saves configuration to the YAML file and also saves the user filter contents to a file
|
// Saves configuration to the YAML file and also saves the user filter contents to a file
|
||||||
func writeConfig() error {
|
func writeConfig() error {
|
||||||
|
c.Lock()
|
||||||
|
defer c.Unlock()
|
||||||
configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
|
configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
|
||||||
log.Printf("Writing YAML file: %s", configFile)
|
log.Printf("Writing YAML file: %s", configFile)
|
||||||
yamlText, err := yaml.Marshal(&config)
|
yamlText, err := yaml.Marshal(&config)
|
||||||
|
|
Loading…
Reference in New Issue