From 8028c6621c59fca3658529da7cc6164078ddf2f9 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Thu, 26 Dec 2019 17:52:44 +0100 Subject: [PATCH] add temporary workaround to release all IPs speed up one failure --- ip_manager/throttle.go | 10 ++++++++++ manager/manager.go | 7 +++++++ manager/ytsync.go | 1 + 3 files changed, 18 insertions(+) diff --git a/ip_manager/throttle.go b/ip_manager/throttle.go index 6f8113b..ee4ddda 100644 --- a/ip_manager/throttle.go +++ b/ip_manager/throttle.go @@ -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) } +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) { i.lock.Lock() defer i.lock.Unlock() diff --git a/manager/manager.go b/manager/manager.go index 97d897e..35026b9 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -7,6 +7,7 @@ import ( "time" "github.com/lbryio/ytsync/blobs_reflector" + "github.com/lbryio/ytsync/ip_manager" "github.com/lbryio/ytsync/namer" "github.com/lbryio/ytsync/sdk" logUtils "github.com/lbryio/ytsync/util" @@ -202,6 +203,12 @@ func (s *SyncManager) Start() error { shouldNotCount := false logUtils.SendInfoToSlack("Syncing %s (%s) to LBRY! total processed channels since startup: %d", sync.LbryChannelName, sync.YoutubeChannelID, syncCount+1) 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 { fatalErrors := []string{ "default_wallet already exists", diff --git a/manager/ytsync.go b/manager/ytsync.go index e7a136c..53de4e8 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -895,6 +895,7 @@ func (s *Sync) startWorker(workerNum int) { "requested format not available", "interrupted by user", "Sign in to confirm your age", + "This video is unavailable", } if util.SubstringInSlice(err.Error(), errorsNoRetry) { log.Println("This error should not be retried at all")