Unsubscribe feed channel if channel not found
This commit is contained in:
parent
b0b00014d5
commit
c3afe77e2d
|
@ -12,6 +12,9 @@ const prepared = {
|
||||||
),
|
),
|
||||||
channel_refreshed_update: db.prepare(
|
channel_refreshed_update: db.prepare(
|
||||||
"UPDATE Channels SET refreshed = ? WHERE ucid = ?"
|
"UPDATE Channels SET refreshed = ? WHERE ucid = ?"
|
||||||
|
),
|
||||||
|
unsubscribe_all_from_channel: db.prepare(
|
||||||
|
"DELETE FROM Subscriptions WHERE ucid = ?"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +88,10 @@ class Refresher {
|
||||||
console.log(`updated ${root.length} videos for channel ${ucid}`)
|
console.log(`updated ${root.length} videos for channel ${ucid}`)
|
||||||
} else if (root.identifier === "PUBLISHED_DATES_NOT_PROVIDED") {
|
} else if (root.identifier === "PUBLISHED_DATES_NOT_PROVIDED") {
|
||||||
return [] // nothing we can do. skip this iteration.
|
return [] // nothing we can do. skip this iteration.
|
||||||
|
} else if (root.identifier === "NOT_FOUND") {
|
||||||
|
// the channel does not exist. we should unsubscribe all users so we don't try again.
|
||||||
|
console.log(`channel ${ucid} does not exist, unsubscribing all users`)
|
||||||
|
prepared.unsubscribe_all_from_channel.run(ucid)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(root.error)
|
throw new Error(root.error)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue