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

View file

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

View file

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