update stoponce
This commit is contained in:
parent
ecba1014f8
commit
607a79f40a
1 changed files with 7 additions and 8 deletions
15
ytsync.go
15
ytsync.go
|
@ -22,7 +22,6 @@ 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"
|
||||||
|
|
||||||
"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"
|
"google.golang.org/api/youtube/v3"
|
||||||
|
@ -152,7 +151,7 @@ func (s *Sync) FullCycle() error {
|
||||||
WaitForDaemonStart:
|
WaitForDaemonStart:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-s.stop.Chan():
|
case <-s.stop.Ch():
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
_, err := s.daemon.WalletBalance()
|
_, err := s.daemon.WalletBalance()
|
||||||
|
@ -211,7 +210,7 @@ func (s *Sync) startWorker(workerNum int) {
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-s.stop.Chan():
|
case <-s.stop.Ch():
|
||||||
log.Printf("Stopping worker %d", workerNum)
|
log.Printf("Stopping worker %d", workerNum)
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
|
@ -222,7 +221,7 @@ func (s *Sync) startWorker(workerNum int) {
|
||||||
if !more {
|
if !more {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case <-s.stop.Chan():
|
case <-s.stop.Ch():
|
||||||
log.Printf("Stopping worker %d", workerNum)
|
log.Printf("Stopping worker %d", workerNum)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -333,14 +332,14 @@ func (s *Sync) enqueueYoutubeVideos() error {
|
||||||
Enqueue:
|
Enqueue:
|
||||||
for _, v := range videos {
|
for _, v := range videos {
|
||||||
select {
|
select {
|
||||||
case <-s.stop.Chan():
|
case <-s.stop.Ch():
|
||||||
break Enqueue
|
break Enqueue
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case s.queue <- v:
|
case s.queue <- v:
|
||||||
case <-s.stop.Chan():
|
case <-s.stop.Ch():
|
||||||
break Enqueue
|
break Enqueue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,14 +381,14 @@ func (s *Sync) enqueueUCBVideos() error {
|
||||||
Enqueue:
|
Enqueue:
|
||||||
for _, v := range videos {
|
for _, v := range videos {
|
||||||
select {
|
select {
|
||||||
case <-s.stop.Chan():
|
case <-s.stop.Ch():
|
||||||
break Enqueue
|
break Enqueue
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case s.queue <- v:
|
case s.queue <- v:
|
||||||
case <-s.stop.Chan():
|
case <-s.stop.Ch():
|
||||||
break Enqueue
|
break Enqueue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue