add disk space check
remove unneeded panics improve error handling add tests fix error checking that was comparing for exact values sort imports
This commit is contained in:
parent
923f58767c
commit
e4bc1897f3
1 changed files with 6 additions and 6 deletions
12
ytsync.go
12
ytsync.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -22,13 +23,11 @@ import (
|
||||||
"github.com/lbryio/lbry.go/ytsync/redisdb"
|
"github.com/lbryio/lbry.go/ytsync/redisdb"
|
||||||
"github.com/lbryio/lbry.go/ytsync/sources"
|
"github.com/lbryio/lbry.go/ytsync/sources"
|
||||||
|
|
||||||
"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"
|
||||||
"google.golang.org/api/googleapi/transport"
|
"google.golang.org/api/googleapi/transport"
|
||||||
"google.golang.org/api/youtube/v3"
|
youtube "google.golang.org/api/youtube/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -246,7 +245,7 @@ func (s *Sync) startWorker(workerNum int) {
|
||||||
":5279: read: connection reset by peer",
|
":5279: read: connection reset by peer",
|
||||||
"net/http: request canceled (Client.Timeout exceeded while awaiting headers)",
|
"net/http: request canceled (Client.Timeout exceeded while awaiting headers)",
|
||||||
}
|
}
|
||||||
if util.InSlice(err.Error(), fatalErrors) || s.StopOnError {
|
if util.InSliceContains(err.Error(), fatalErrors) || s.StopOnError {
|
||||||
s.grp.Stop()
|
s.grp.Stop()
|
||||||
} else if s.MaxTries > 1 {
|
} else if s.MaxTries > 1 {
|
||||||
errorsNoRetry := []string{
|
errorsNoRetry := []string{
|
||||||
|
@ -259,12 +258,13 @@ func (s *Sync) startWorker(workerNum int) {
|
||||||
"Error in daemon: Cannot publish empty file",
|
"Error in daemon: Cannot publish empty file",
|
||||||
"Error extracting sts from embedded url response",
|
"Error extracting sts from embedded url response",
|
||||||
}
|
}
|
||||||
if util.InSlice(err.Error(), errorsNoRetry) {
|
if util.InSliceContains(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") {
|
strings.Contains(err.Error(), "Error in daemon: Insufficient funds, please deposit additional LBC") ||
|
||||||
|
strings.Contains(err.Error(), "The transaction was rejected by network rules.(64: too-long-mempool-chain)") {
|
||||||
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 {
|
||||||
|
|
Loading…
Reference in a new issue