add fail state
add panic/edge cases add marking channels as completed/failed
This commit is contained in:
parent
c0be626ef2
commit
e600fb59fa
2 changed files with 23 additions and 2 deletions
|
@ -15,6 +15,7 @@ const (
|
||||||
StatusQueued = "queued" // in sync queue. will be synced soon
|
StatusQueued = "queued" // in sync queue. will be synced soon
|
||||||
StatusSyncing = "syncing" // syncing now
|
StatusSyncing = "syncing" // syncing now
|
||||||
StatusSynced = "synced" // done
|
StatusSynced = "synced" // done
|
||||||
|
StatusFailed = "failed"
|
||||||
)
|
)
|
||||||
|
|
||||||
var SyncStatuses = []string{StatusPending, StatusQueued, StatusSyncing, StatusSynced}
|
var SyncStatuses = []string{StatusPending, StatusQueued, StatusSyncing, StatusSynced, StatusFailed}
|
||||||
|
|
|
@ -157,7 +157,7 @@ func selfSync(cmd *cobra.Command, args []string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg := fmt.Sprintf("Failed aquiring sync rights for channel %s: %v", lbryChannelName, err)
|
msg := fmt.Sprintf("Failed aquiring sync rights for channel %s: %v", lbryChannelName, err)
|
||||||
util.SendToSlack(msg)
|
util.SendToSlack(msg)
|
||||||
log.Debugln(msg)
|
log.Error(msg)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf("Syncing %s to LBRY! (iteration %d)", lbryChannelName, loops)
|
msg := fmt.Sprintf("Syncing %s to LBRY! (iteration %d)", lbryChannelName, loops)
|
||||||
|
@ -180,8 +180,28 @@ func selfSync(cmd *cobra.Command, args []string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(errors.FullTrace(err))
|
log.Error(errors.FullTrace(err))
|
||||||
util.SendToSlack(errors.FullTrace(err))
|
util.SendToSlack(errors.FullTrace(err))
|
||||||
|
//mark video as failed
|
||||||
|
err := setChannelSyncStatus(authToken, channelID, StatusFailed)
|
||||||
|
if err != nil {
|
||||||
|
msg := fmt.Sprintf("Failed setting failed state for channel %s: %v", lbryChannelName, err)
|
||||||
|
util.SendToSlack(msg)
|
||||||
|
util.SendToSlack("@Nikooo777 this requires manual intervention! Panicing...")
|
||||||
|
log.Error(msg)
|
||||||
|
panic(msg)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
//mark video as synced
|
||||||
|
err = setChannelSyncStatus(authToken, channelID, StatusSynced)
|
||||||
|
if err != nil {
|
||||||
|
msg := fmt.Sprintf("Failed setting synced state for channel %s: %v", lbryChannelName, err)
|
||||||
|
util.SendToSlack(msg)
|
||||||
|
util.SendToSlack("@Nikooo777 this requires manual intervention! Panicing...")
|
||||||
|
log.Error(msg)
|
||||||
|
//this error is very bad. it requires manual intervention
|
||||||
|
panic(msg)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if limit != 0 && loops >= limit {
|
if limit != 0 && loops >= limit {
|
||||||
msg := fmt.Sprintf("limit of %d reached! Stopping", limit)
|
msg := fmt.Sprintf("limit of %d reached! Stopping", limit)
|
||||||
|
|
Loading…
Reference in a new issue