add temporary workaround to release all IPs

speed up one failure
This commit is contained in:
Niko Storni 2019-12-26 17:52:44 +01:00
parent 8abf6ad255
commit 8028c6621c
3 changed files with 18 additions and 0 deletions

View file

@ -121,6 +121,16 @@ func (i *IPPool) ReleaseIP(ip string) {
util.SendErrorToSlack("something went wrong while releasing the IP %s as we reached the end of the function", ip) util.SendErrorToSlack("something went wrong while releasing the IP %s as we reached the end of the function", ip)
} }
func (i *IPPool) ReleaseAll() {
i.lock.Lock()
defer i.lock.Unlock()
for j, _ := range i.ips {
localIP := &i.ips[j]
localIP.InUse = false
localIP.LastUse = time.Now()
}
}
func (i *IPPool) SetThrottled(ip string) { func (i *IPPool) SetThrottled(ip string) {
i.lock.Lock() i.lock.Lock()
defer i.lock.Unlock() defer i.lock.Unlock()

View file

@ -7,6 +7,7 @@ import (
"time" "time"
"github.com/lbryio/ytsync/blobs_reflector" "github.com/lbryio/ytsync/blobs_reflector"
"github.com/lbryio/ytsync/ip_manager"
"github.com/lbryio/ytsync/namer" "github.com/lbryio/ytsync/namer"
"github.com/lbryio/ytsync/sdk" "github.com/lbryio/ytsync/sdk"
logUtils "github.com/lbryio/ytsync/util" logUtils "github.com/lbryio/ytsync/util"
@ -202,6 +203,12 @@ func (s *SyncManager) Start() error {
shouldNotCount := false shouldNotCount := false
logUtils.SendInfoToSlack("Syncing %s (%s) to LBRY! total processed channels since startup: %d", sync.LbryChannelName, sync.YoutubeChannelID, syncCount+1) logUtils.SendInfoToSlack("Syncing %s (%s) to LBRY! total processed channels since startup: %d", sync.LbryChannelName, sync.YoutubeChannelID, syncCount+1)
err := sync.FullCycle() err := sync.FullCycle()
//TODO: THIS IS A TEMPORARY WORK AROUND FOR THE STUPID IP LOCKUP BUG
ipPool, _ := ip_manager.GetIPPool(sync.grp)
if ipPool != nil {
ipPool.ReleaseAll()
}
if err != nil { if err != nil {
fatalErrors := []string{ fatalErrors := []string{
"default_wallet already exists", "default_wallet already exists",

View file

@ -895,6 +895,7 @@ func (s *Sync) startWorker(workerNum int) {
"requested format not available", "requested format not available",
"interrupted by user", "interrupted by user",
"Sign in to confirm your age", "Sign in to confirm your age",
"This video is unavailable",
} }
if util.SubstringInSlice(err.Error(), errorsNoRetry) { 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")