prevent live streams from syncing

reduce timeout to 20 minutes
This commit is contained in:
Niko Storni 2020-04-29 16:15:22 +02:00
parent 69c2a91ec7
commit 95890cbabf
3 changed files with 6 additions and 2 deletions

View file

@ -86,7 +86,7 @@ func abandonSupports(s *Sync) (float64, error) {
consumerWG := &stop.Group{} consumerWG := &stop.Group{}
//TODO: remove this once the SDK team fixes their RPC bugs.... //TODO: remove this once the SDK team fixes their RPC bugs....
s.daemon.SetRPCTimeout(30 * time.Second) s.daemon.SetRPCTimeout(30 * time.Second)
defer s.daemon.SetRPCTimeout(40 * time.Minute) defer s.daemon.SetRPCTimeout(20 * time.Minute)
for i := 0; i < s.ConcurrentVideos; i++ { for i := 0; i < s.ConcurrentVideos; i++ {
consumerWG.Add(1) consumerWG.Add(1)
go func() { go func() {

View file

@ -307,7 +307,7 @@ func (s *Sync) FullCycle() (e error) {
log.Infoln("Waiting for daemon to finish starting...") log.Infoln("Waiting for daemon to finish starting...")
s.daemon = jsonrpc.NewClient(os.Getenv("LBRYNET_ADDRESS")) s.daemon = jsonrpc.NewClient(os.Getenv("LBRYNET_ADDRESS"))
s.daemon.SetRPCTimeout(40 * time.Minute) s.daemon.SetRPCTimeout(20 * time.Minute)
err = s.waitForDaemonStart() err = s.waitForDaemonStart()
if err != nil { if err != nil {
@ -904,6 +904,7 @@ func (s *Sync) startWorker(workerNum int) {
"interrupted by user", "interrupted by user",
"Sign in to confirm your age", "Sign in to confirm your age",
"This video is unavailable", "This video is unavailable",
"video is a live stream and hasn't completed yet",
} }
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")

View file

@ -180,6 +180,9 @@ func (v *YoutubeVideo) getAbbrevDescription() string {
} }
func (v *YoutubeVideo) download() error { func (v *YoutubeVideo) download() error {
if v.youtubeInfo.Snippet.LiveBroadcastContent != "none" {
return errors.Err("video is a live stream and hasn't completed yet")
}
videoPath := v.getFullPath() videoPath := v.getFullPath()
err := os.Mkdir(v.videoDir(), 0777) err := os.Mkdir(v.videoDir(), 0777)