improve error handling
retry wallet uploads on failure
This commit is contained in:
parent
23690731af
commit
84790720ff
2 changed files with 12 additions and 1 deletions
|
@ -286,6 +286,8 @@ func (s *Sync) setChannelTerminationStatus(e *error) {
|
||||||
"interrupted during daemon startup",
|
"interrupted during daemon startup",
|
||||||
"interrupted by user",
|
"interrupted by user",
|
||||||
"use --skip-space-check to ignore",
|
"use --skip-space-check to ignore",
|
||||||
|
"failure uploading blockchain DB",
|
||||||
|
"default_wallet already exists",
|
||||||
}
|
}
|
||||||
dbWipeConditions := []string{
|
dbWipeConditions := []string{
|
||||||
"Missing inputs",
|
"Missing inputs",
|
||||||
|
@ -348,11 +350,16 @@ func (s *Sync) stopAndUploadWallet(e *error) {
|
||||||
logShutdownError(processDeathError)
|
logShutdownError(processDeathError)
|
||||||
} else {
|
} else {
|
||||||
err := s.uploadWallet()
|
err := s.uploadWallet()
|
||||||
|
if err != nil {
|
||||||
|
time.Sleep(10 * time.Second)
|
||||||
|
logUtils.SendErrorToSlack("there was a problem uploading the wallet to S3, waiting 10 seconds and retrying: %s", err.Error())
|
||||||
|
err = s.uploadWallet()
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if *e == nil {
|
if *e == nil {
|
||||||
*e = err
|
*e = err
|
||||||
} else {
|
} else {
|
||||||
*e = errors.Prefix("failure uploading wallet", *e)
|
*e = errors.Prefix(fmt.Sprintf("failure uploading wallet: %s + original error", errors.FullTrace(err)), *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = s.uploadBlockchainDB()
|
err = s.uploadBlockchainDB()
|
||||||
|
|
|
@ -14,7 +14,9 @@ func SendErrorToSlack(format string, a ...interface{}) {
|
||||||
message = fmt.Sprintf(format, a...)
|
message = fmt.Sprintf(format, a...)
|
||||||
}
|
}
|
||||||
log.Errorln(message)
|
log.Errorln(message)
|
||||||
|
log.SetLevel(log.InfoLevel) //I don't want to change the underlying lib so this will do...
|
||||||
err := util.SendToSlack(":sos: ```" + message + "```")
|
err := util.SendToSlack(":sos: ```" + message + "```")
|
||||||
|
log.SetLevel(log.DebugLevel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
}
|
}
|
||||||
|
@ -27,7 +29,9 @@ func SendInfoToSlack(format string, a ...interface{}) {
|
||||||
message = fmt.Sprintf(format, a...)
|
message = fmt.Sprintf(format, a...)
|
||||||
}
|
}
|
||||||
log.Infoln(message)
|
log.Infoln(message)
|
||||||
|
log.SetLevel(log.InfoLevel) //I don't want to change the underlying lib so this will do...
|
||||||
err := util.SendToSlack(":information_source: " + message)
|
err := util.SendToSlack(":information_source: " + message)
|
||||||
|
log.SetLevel(log.DebugLevel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue