address more errors for better automation

This commit is contained in:
Niko Storni 2018-04-30 15:18:27 -04:00
parent 94acc180c2
commit 07004be3b4

View file

@ -23,6 +23,7 @@ import (
"github.com/lbryio/lbry.go/ytsync/sources" "github.com/lbryio/lbry.go/ytsync/sources"
"fmt" "fmt"
"github.com/lbryio/lbry.go/util" "github.com/lbryio/lbry.go/util"
"github.com/mitchellh/go-ps" "github.com/mitchellh/go-ps"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
@ -244,20 +245,28 @@ func (s *Sync) startWorker(workerNum int) {
if err != nil { if err != nil {
logMsg := fmt.Sprintf("error processing video: " + err.Error()) logMsg := fmt.Sprintf("error processing video: " + err.Error())
log.Errorln(logMsg) log.Errorln(logMsg)
fatalErrors := []string{
if s.StopOnError { ":5279: read: connection reset by peer",
"net/http: request canceled (Client.Timeout exceeded while awaiting headers)",
}
if util.InSlice(err.Error(), fatalErrors) || s.StopOnError {
s.grp.Stop() s.grp.Stop()
} else if s.MaxTries > 1 { } else if s.MaxTries > 1 {
if strings.Contains(err.Error(), "non 200 status code received") || errorsNoRetry := []string{
strings.Contains(err.Error(), " reason: 'This video contains content from") || "non 200 status code received",
strings.Contains(err.Error(), "dont know which claim to update") || " reason: 'This video contains content from",
strings.Contains(err.Error(), "uploader has not made this video available in your country") || "dont know which claim to update",
strings.Contains(err.Error(), "download error: AccessDenied: Access Denied") || "uploader has not made this video available in your country",
strings.Contains(err.Error(), "Playback on other websites has been disabled by the video owner") { "download error: AccessDenied: Access Denied",
"Playback on other websites has been disabled by the video owner",
"Error in daemon: Cannot publish empty file",
}
if util.InSlice(err.Error(), errorsNoRetry) {
log.Println("This error should not be retried at all") log.Println("This error should not be retried at all")
} else if tryCount < s.MaxTries { } else if tryCount < s.MaxTries {
if strings.Contains(err.Error(), "The transaction was rejected by network rules.(258: txn-mempool-conflict)") || if strings.Contains(err.Error(), "The transaction was rejected by network rules.(258: txn-mempool-conflict)") ||
strings.Contains(err.Error(), "failed: Not enough funds") { strings.Contains(err.Error(), "failed: Not enough funds") ||
strings.Contains(err.Error(), "Error in daemon: Insufficient funds, please deposit additional LBC") {
log.Println("waiting for a block and refilling addresses before retrying") log.Println("waiting for a block and refilling addresses before retrying")
err = s.walletSetup() err = s.walletSetup()
if err != nil { if err != nil {