Skip to content

Commit

Permalink
Don't handle shadowhide on high load
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Jan 3, 2024
1 parent 84fd7c1 commit 0edf0b9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/routes/getSkipSegments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ async function prepareCategorySegments(req: Request, videoID: VideoID, service:
const fetchData = () => privateDB.prepare("all", 'SELECT "hashedIP" FROM "sponsorTimes" WHERE "videoID" = ? AND "timeSubmitted" = ? AND "service" = ?',
[videoID, segment.timeSubmitted, service], { useReplica: true }) as Promise<{ hashedIP: HashedIP }[]>;
try {
if (db.highLoad() || privateDB.highLoad()) throw new Error("High load, not handling shadowhide");

cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted] = await promiseOrTimeout(QueryCacher.get(fetchData, shadowHiddenIPKey(videoID, segment.timeSubmitted, service)), 150);
} catch (e) {
// give up on shadowhide for now
Expand Down

0 comments on commit 0edf0b9

Please sign in to comment.