fix max length issue for bigger youtubers

fix issue with no-playlist-found channels
reduce the max db size limit
This commit is contained in:
Niko Storni 2020-04-08 23:14:10 +02:00
parent 79d3aadda8
commit 5d40d24804
3 changed files with 12 additions and 3 deletions

View file

@ -168,8 +168,9 @@ func (s *SyncManager) Start() error {
}
for i, c := range channels {
log.Infof("There are %d channels in the \"%s\" queue", len(channels)-i, q)
maxVideoLength := s.maxVideoLength
if c.TotalSubscribers < 1000 {
s.maxVideoLength = 1.0
maxVideoLength = 1.0
}
syncs = append(syncs, Sync{
APIConfig: s.apiConfig,
@ -178,6 +179,7 @@ func (s *SyncManager) Start() error {
lbryChannelID: c.ChannelClaimID,
MaxTries: s.maxTries,
ConcurrentVideos: s.concurrentVideos,
MaxVideoLength: maxVideoLength,
Refill: s.refill,
Manager: s,
LbrycrdString: s.lbrycrdString,

View file

@ -91,6 +91,7 @@ type Sync struct {
clientPublishAddress string
publicKey string
defaultAccountID string
MaxVideoLength float64
}
func (s *Sync) AppendSyncedVideo(videoID string, published bool, failureReason string, claimName string, claimID string, metadataVersion int8, size int64) {
@ -979,6 +980,8 @@ func (s *Sync) startWorker(workerNum int) {
}
}
var mostRecentlyFailedChannel string
func (s *Sync) enqueueYoutubeVideos() error {
client := &http.Client{
Transport: &transport.APIKey{Key: s.APIConfig.YoutubeAPIKey},
@ -1033,6 +1036,10 @@ func (s *Sync) enqueueYoutubeVideos() error {
if youtubeIsLying {
break
}
if s.YoutubeChannelID == mostRecentlyFailedChannel {
return errors.Err("playlist items not found")
}
mostRecentlyFailedChannel = s.YoutubeChannelID
break //return errors.Err("playlist items not found") //TODO: will this work?
}
videoIDs := make([]string, 50)
@ -1158,7 +1165,7 @@ func (s *Sync) processVideo(v video) (err error) {
ChannelID: s.lbryChannelID,
MaxVideoSize: s.Manager.maxVideoSize,
Namer: s.namer,
MaxVideoLength: s.Manager.maxVideoLength,
MaxVideoLength: s.MaxVideoLength,
Fee: s.Fee,
DefaultAccount: da,
}

View file

@ -253,7 +253,7 @@ func CleanupLbrynet() error {
}
return errors.Err(err)
}
dbSizeLimit := int64(2 * 1024 * 1024 * 1024)
dbSizeLimit := int64(1 * 1024 * 1024 * 1024)
if db.Size() > dbSizeLimit {
files, err := filepath.Glob(lbryumDir + "/blockchain.db*")
if err != nil {