add VideoUpgradeFailed staus

This commit is contained in:
Niko Storni 2019-06-10 21:59:42 +02:00
parent 0c42b96332
commit f7f0231c80
3 changed files with 10 additions and 6 deletions

View file

@ -91,9 +91,10 @@ const (
var SyncStatuses = []string{StatusPending, StatusPendingEmail, StatusPendingUpgrade, StatusQueued, StatusSyncing, StatusSynced, StatusFailed, StatusFinalized, StatusAbandoned} var SyncStatuses = []string{StatusPending, StatusPendingEmail, StatusPendingUpgrade, StatusQueued, StatusSyncing, StatusSynced, StatusFailed, StatusFinalized, StatusAbandoned}
const ( const (
VideoStatusPublished = "published" VideoStatusPublished = "published"
VideoStatusFailed = "failed" VideoStatusFailed = "failed"
VideoStatusUnpublished = "unpublished" VideoStatusUpgradeFailed = "upgradefailed"
VideoStatusUnpublished = "unpublished"
) )
func (s *SyncManager) Start() error { func (s *SyncManager) Start() error {

View file

@ -711,9 +711,12 @@ func (s *Sync) startWorker(workerNum int) {
existingClaimSize = &existingClaim.Size existingClaimSize = &existingClaim.Size
} }
} }
videoStatus := VideoStatusFailed
if strings.Contains(err.Error(), "upgrade failed") {
videoStatus = VideoStatusUpgradeFailed
}
s.AppendSyncedVideo(v.ID(), false, err.Error(), "") s.AppendSyncedVideo(v.ID(), false, err.Error(), "")
err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusFailed, existingClaimID, existingClaimName, err.Error(), existingClaimSize, 0) err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), videoStatus, existingClaimID, existingClaimName, err.Error(), existingClaimSize, 0)
if err != nil { if err != nil {
SendErrorToSlack("Failed to mark video on the database: %s", err.Error()) SendErrorToSlack("Failed to mark video on the database: %s", err.Error())
} }

View file

@ -378,7 +378,7 @@ func (v *YoutubeVideo) Sync(daemon *jsonrpc.Client, params SyncParams, existingV
v.lbryChannelID = params.ChannelID v.lbryChannelID = params.ChannelID
if reprocess && existingVideoData != nil && existingVideoData.Published { if reprocess && existingVideoData != nil && existingVideoData.Published {
summary, err := v.reprocess(daemon, params, existingVideoData) summary, err := v.reprocess(daemon, params, existingVideoData)
return summary, err return summary, errors.Prefix("upgrade failed", err)
} }
return v.downloadAndPublish(daemon, params) return v.downloadAndPublish(daemon, params)
} }