Create restart.sentinel after storing peer list
Otherwise, we risk to lose peer list when any failure happens after the creation but before storing the list and as a consequence, the weave container gets restarted.
This commit is contained in:
1 parent
c720ebec02
commit
cdeae04238
2 files changed
+11
-6
No files matched your search
@@ -239,12 +239,16 @@ func (router *NetworkRouter) InitialPeers(resume bool, peers []string) ([]string
|
||||
return storedPeers, nil
|
||||
}
|
||||
|
||||
sentinel, err := os.Create("restart.sentinel")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating sentinel: %v", err)
|
||||
}
|
||||
sentinel.Close()
|
||||
|
||||
log.Println("Launch detected - using supplied peer list:", peers)
|
||||
return peers, nil
|
||||
}
|
||||
|
||||
func (router *NetworkRouter) CreateRestartSentinel() error {
|
||||
sentinel, err := os.Create("restart.sentinel")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating sentinel: %v", err)
|
||||
}
|
||||
sentinel.Close()
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user