From 59266a6419cad0ab5d0707d2e48a8919b8b663bc Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 7 Apr 2023 21:43:39 +1200 Subject: [PATCH] Manually opening a channel will check its status again --- utils/youtube.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/utils/youtube.js b/utils/youtube.js index c1554c3..8742f9e 100644 --- a/utils/youtube.js +++ b/utils/youtube.js @@ -26,22 +26,13 @@ async function fetchChannel(path, ucid, instance) { if (!instance) throw new Error("No instance parameter provided") const row = db.prepare("SELECT * FROM Channels WHERE ucid = ?").get(ucid) - - // handle the case where the channel has a known error - if (row && row.missing_reason) { - return { - error: true, - ucid, - row, - missing: true, - message: row.missing_reason - } - } + // can branch on row.missing if needed, but account termination is not permanent, + // so we need to fetch new data from the web either way... /** @type {any} */ const channel = await request(`${instance}/api/v1/channels/${ucid}?second__path=${path}`).then(res => res.json()) - // handle the case where the channel has a newly discovered error + // handle the case where the just-fetched channel has an error if (channel.error) { const missingData = updateBadData(channel) return { @@ -52,7 +43,7 @@ async function fetchChannel(path, ucid, instance) { } } - // handle the case where the channel returns good data (this is the only remaining scenario) + // handle the case where the just-fetched channel does not have an error updateGoodData(channel) return channel }