diff --git a/src/routes/getSkipSegments.ts b/src/routes/getSkipSegments.ts index f2fc200c..89780401 100644 --- a/src/routes/getSkipSegments.ts +++ b/src/routes/getSkipSegments.ts @@ -43,20 +43,20 @@ async function prepareCategorySegments(req: Request, videoID: VideoID, service: 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); + cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted] = promiseOrTimeout(QueryCacher.get(fetchData, shadowHiddenIPKey(videoID, segment.timeSubmitted, service)), 150); } catch (e) { // give up on shadowhide for now cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted] = null; } } - const ipList = cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted]; + const ipList = await cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted]; if (ipList?.length > 0 && cache.userHashedIP === undefined) { cache.userHashedIP = await cache.userHashedIPPromise; } //if this isn't their ip, don't send it to them - const shouldShadowHide = cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted]?.some( + const shouldShadowHide = ipList?.some( (shadowHiddenSegment) => shadowHiddenSegment.hashedIP === cache.userHashedIP) ?? false; if (shouldShadowHide) useCache = false; diff --git a/src/types/segments.model.ts b/src/types/segments.model.ts index 6f1c3e0c..c58137fe 100644 --- a/src/types/segments.model.ts +++ b/src/types/segments.model.ts @@ -103,7 +103,7 @@ export interface VideoData { } export interface SegmentCache { - shadowHiddenSegmentIPs: SBRecord>, + shadowHiddenSegmentIPs: SBRecord>>, userHashedIP?: HashedIP userHashedIPPromise?: Promise; }