From 0f8cebd0325b8574753cce1ad843d95574059773 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Wed, 24 May 2023 17:41:25 +0530 Subject: [PATCH] remove download manager logging --- apps/photos/src/services/downloadManager.ts | 19 --------------- .../publicCollectionDownloadManager.ts | 24 +++---------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/apps/photos/src/services/downloadManager.ts b/apps/photos/src/services/downloadManager.ts index 2ff5e329c..e0c53eb56 100644 --- a/apps/photos/src/services/downloadManager.ts +++ b/apps/photos/src/services/downloadManager.ts @@ -13,7 +13,6 @@ import { FILE_TYPE } from 'constants/file'; import { CustomError } from 'utils/error'; import QueueProcessor, { PROCESSING_STRATEGY } from './queueProcessor'; import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker'; -import { addLogLine } from 'utils/logging'; import { CacheStorageService } from './cache/cacheStorageService'; import { CACHES } from 'constants/cache'; import { Remote } from 'comlink'; @@ -40,16 +39,10 @@ class DownloadManager { timeout?: number ) { try { - addLogLine(`[${file.id}] [DownloadManager] getThumbnail called`); const token = tokenOverride || getToken(); if (!token) { return null; } - if (this.thumbnailObjectURLPromise.has(file.id)) { - addLogLine( - `[${file.id}] [DownloadManager] getThumbnail promise cache hit, returning existing promise` - ); - } if (!this.thumbnailObjectURLPromise.has(file.id)) { const downloadPromise = async () => { const thumbnailCache = await CacheStorageService.open( @@ -60,14 +53,8 @@ class DownloadManager { file.id.toString() ); if (cacheResp) { - addLogLine( - `[${file.id}] [DownloadManager] in memory cache hit, using localCache files` - ); return URL.createObjectURL(await cacheResp.blob()); } - addLogLine( - `[${file.id}] [DownloadManager] in memory cache miss, DownloadManager getThumbnail download started` - ); const thumb = await this.thumbnailDownloadRequestsProcessor.queueUpRequest( () => @@ -128,7 +115,6 @@ class DownloadManager { const fileKey = forPreview ? `${file.id}_preview` : `${file.id}`; try { const getFilePromise = async () => { - addLogLine(`[${file.id}] [DownloadManager] downloading file`); const fileStream = await this.downloadFile(file); const fileBlob = await new Response(fileStream).blob(); if (forPreview) { @@ -141,11 +127,6 @@ class DownloadManager { return { converted: [fileURL], original: [fileURL] }; } }; - if (this.fileObjectURLPromise.has(fileKey)) { - addLogLine( - `[${file.id}] [DownloadManager] getFile promise cache hit, returning existing promise` - ); - } if (!this.fileObjectURLPromise.get(fileKey)) { this.fileObjectURLPromise.set(fileKey, getFilePromise()); } diff --git a/apps/photos/src/services/publicCollectionDownloadManager.ts b/apps/photos/src/services/publicCollectionDownloadManager.ts index 45e3eaaf9..906867079 100644 --- a/apps/photos/src/services/publicCollectionDownloadManager.ts +++ b/apps/photos/src/services/publicCollectionDownloadManager.ts @@ -15,7 +15,6 @@ import { FILE_TYPE } from 'constants/file'; import { CustomError } from 'utils/error'; import QueueProcessor from './queueProcessor'; import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker'; -import { addLogLine } from 'utils/logging'; class PublicCollectionDownloadManager { private fileObjectURLPromise = new Map< @@ -31,16 +30,11 @@ class PublicCollectionDownloadManager { token: string, passwordToken: string ) { - addLogLine(`[${file.id}] [PublicDownloadManger] getThumbnail called`); try { if (!token) { return null; } - if (this.thumbnailObjectURLPromise.has(file.id)) { - addLogLine( - `[${file.id}] [PublicDownloadManger] getThumbnail promise cache hit, returning existing promise` - ); - } + if (!this.thumbnailObjectURLPromise.has(file.id)) { const downloadPromise = async () => { const thumbnailCache = await (async () => { @@ -57,14 +51,9 @@ class PublicCollectionDownloadManager { ); if (cacheResp) { - addLogLine( - `[${file.id}] [PublicDownloadManger] in memory cache hit, using localCache files` - ); return URL.createObjectURL(await cacheResp.blob()); } - addLogLine( - `[${file.id}] [PublicDownloadManger] in memory cache miss, getThumbnail download started` - ); + const thumb = await this.thumbnailDownloadRequestsProcessor.queueUpRequest( () => this.downloadThumb(token, passwordToken, file) @@ -128,9 +117,6 @@ class PublicCollectionDownloadManager { const fileKey = forPreview ? `${file.id}_preview` : `${file.id}`; try { const getFilePromise = async () => { - addLogLine( - `[${file.id}] [PublicDownloadManager] downloading file` - ); const fileStream = await this.downloadFile( token, passwordToken, @@ -147,11 +133,7 @@ class PublicCollectionDownloadManager { return { converted: [fileURL], original: [fileURL] }; } }; - if (this.fileObjectURLPromise.has(fileKey)) { - addLogLine( - `[${file.id}] [PublicDownloadManager] getFile promise cache hit, returning existing promise` - ); - } + if (!this.fileObjectURLPromise.get(fileKey)) { this.fileObjectURLPromise.set(fileKey, getFilePromise()); }