fix description not containing youtube link

add workaround to SDK bug not spending the right UTXOs
fix bug in assignments
This commit is contained in:
Niko Storni 2019-06-13 19:33:58 +02:00
parent e893f68bc1
commit 6668840b11
3 changed files with 17 additions and 8 deletions

View file

@ -676,18 +676,27 @@ func (s *Sync) startWorker(workerNum int) {
"have blocked it on copyright grounds", "have blocked it on copyright grounds",
"the video must be republished as we can't get the right size", "the video must be republished as we can't get the right size",
} }
if util.SubstringInSlice(err.Error(), errorsNoRetry) { if strings.Contains(err.Error(), "txn-mempool-conflict") ||
strings.Contains(err.Error(), "too-long-mempool-chain") {
log.Println("waiting for a block before retrying")
err := s.waitForNewBlock()
if err != nil {
s.grp.Stop()
SendErrorToSlack("something went wrong while waiting for a block: %v", err)
break
}
} else if util.SubstringInSlice(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 util.SubstringInSlice(err.Error(), []string{ if util.SubstringInSlice(err.Error(), []string{
"Not enough funds to cover this transaction", "Not enough funds to cover this transaction",
"failed: Not enough funds", "failed: Not enough funds",
"Error in daemon: Insufficient funds, please deposit additional LBC", "Error in daemon: Insufficient funds, please deposit additional LBC",
"txn-mempool-conflict", // "txn-mempool-conflict", //TODO: uncomment the two lines when the SDK will start spending confirmed UTXOs before failing
"too-long-mempool-chain", //"too-long-mempool-chain",
}) { }) {
log.Println("checking funds and UTXOs before retrying...") log.Println("checking funds and UTXOs before retrying...")
err = s.walletSetup() err := s.walletSetup()
if err != nil { if err != nil {
s.grp.Stop() s.grp.Stop()
SendErrorToSlack("failed to setup the wallet for a refill: %v", err) SendErrorToSlack("failed to setup the wallet for a refill: %v", err)

View file

@ -162,14 +162,14 @@ func (v *YoutubeVideo) getFullPath() string {
func (v *YoutubeVideo) getAbbrevDescription() string { func (v *YoutubeVideo) getAbbrevDescription() string {
maxLines := 10 maxLines := 10
description := strings.TrimSpace(v.description) description := strings.TrimSpace(v.description)
if strings.Count(description, "\n") < maxLines {
return description
}
additionalDescription := "\nhttps://www.youtube.com/watch?v=" + v.id additionalDescription := "\nhttps://www.youtube.com/watch?v=" + v.id
khanAcademyClaimID := "5fc52291980268b82413ca4c0ace1b8d749f3ffb" khanAcademyClaimID := "5fc52291980268b82413ca4c0ace1b8d749f3ffb"
if v.lbryChannelID == khanAcademyClaimID { if v.lbryChannelID == khanAcademyClaimID {
additionalDescription = additionalDescription + "\nNote: All Khan Academy content is available for free at (www.khanacademy.org)" additionalDescription = additionalDescription + "\nNote: All Khan Academy content is available for free at (www.khanacademy.org)"
} }
if strings.Count(description, "\n") < maxLines {
return description + "\n..." + additionalDescription
}
return strings.Join(strings.Split(description, "\n")[:maxLines], "\n") + "\n..." + additionalDescription return strings.Join(strings.Split(description, "\n")[:maxLines], "\n") + "\n..." + additionalDescription
} }

View file

@ -488,7 +488,7 @@ var channelWideTags = map[string][]string{
shogogarcia: {"learning"}, shogogarcia: {"learning"},
alphalifestyleacademy: {"learning"}, alphalifestyleacademy: {"learning"},
NileRed: {"learning", "science"}, NileRed: {"learning", "science"},
veritasium: {"learning"}, veritasium: {"learning", "science"},
stevecronin: {"learning"}, stevecronin: {"learning"},
jeranism: {"learning"}, jeranism: {"learning"},
MinutePhysics: {"learning", "science"}, MinutePhysics: {"learning", "science"},