From a0465a44ae9d0462cf038984260d62a08cd2aa5f Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 26 May 2022 22:59:59 -0400 Subject: [PATCH] More logging --- src/routes/getSkipSegments.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/routes/getSkipSegments.ts b/src/routes/getSkipSegments.ts index e2c1ec5..1d10fa5 100644 --- a/src/routes/getSkipSegments.ts +++ b/src/routes/getSkipSegments.ts @@ -25,6 +25,11 @@ async function prepareCategorySegments(req: Request, videoID: VideoID, service: return true; } + if (logData.extraLogging) { + Logger.error(`Starting ip fetch: ${Date.now() - logData.lastTime}, ${Date.now() - logData.startTime}`); + logData.lastTime = Date.now(); + } + if (cache.shadowHiddenSegmentIPs[videoID] === undefined) cache.shadowHiddenSegmentIPs[videoID] = {}; if (cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted] === undefined) { const service = getService(req?.query?.service as string); @@ -37,7 +42,15 @@ async function prepareCategorySegments(req: Request, videoID: VideoID, service: if (ipList?.length > 0 && cache.userHashedIP === undefined) { //hash the IP only if it's strictly necessary + if (logData.extraLogging) { + Logger.error(`Starting hash: ${Date.now() - logData.lastTime}, ${Date.now() - logData.startTime}`); + logData.lastTime = Date.now(); + } cache.userHashedIP = await getHashCache((getIP(req) + config.globalSalt) as IPAddress); + if (logData.extraLogging) { + Logger.error(`Ending hash: ${Date.now() - logData.lastTime}, ${Date.now() - logData.startTime}`); + logData.lastTime = Date.now(); + } } //if this isn't their ip, don't send it to them const shouldShadowHide = cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted]?.some(