Skip to content

Commit

Permalink
fix: remove perf measurements and increase timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
g-tejas committed Aug 7, 2024
1 parent 4237790 commit 4dcaa13
Showing 1 changed file with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ const useDecryptionWorkers = ({
let progress = 0
let timeSinceLastXAttachmentDownload = 0

let totalBlobDownloadTime = 0

return new Promise<DownloadResult>((resolve, reject) => {
reader
.read()
Expand Down Expand Up @@ -235,13 +233,10 @@ const useDecryptionWorkers = ({
}
timeSinceLastXAttachmentDownload = now
}
const startTime = performance.now()
await downloadResponseAttachment(
decryptResult.downloadBlob,
decryptResult.id,
)
const delta = performance.now() - startTime
totalBlobDownloadTime += delta
}
}
}
Expand Down Expand Up @@ -363,11 +358,6 @@ const useDecryptionWorkers = ({
timeDifference,
)

console.log({
'Time it took to download blob url':
totalBlobDownloadTime / csvGenerator.length(),
})

resolve({
expectedCount: responsesCount,
successCount: csvGenerator.length(),
Expand Down Expand Up @@ -454,8 +444,6 @@ const useDecryptionWorkers = ({
freshAbortController,
)

let totalBlobDownloadTime = 0

const processTask = async (value: string, workerIdx: number) => {
const { workerApi } = workerPool[workerIdx]

Expand Down Expand Up @@ -483,14 +471,11 @@ const useDecryptionWorkers = ({
// rate limit to pass. If decryption is fast, we would wait regardless.
// If decryption is slow, we won't hit rate limits.
if (downloadAttachments && decryptResult.downloadBlobURL) {
const startTime = performance.now()
await downloadResponseAttachmentURL(
decryptResult.downloadBlobURL,
decryptResult.id,
)
URL.revokeObjectURL(decryptResult.downloadBlobURL!)
const delta = performance.now() - startTime
totalBlobDownloadTime += delta
URL.revokeObjectURL(decryptResult.downloadBlobURL)
}
break
case CsvRecordStatus.Unknown:
Expand Down Expand Up @@ -532,7 +517,7 @@ const useDecryptionWorkers = ({
const finishedTasks: number[] = []
for (let i = 0; i < pendingTasks.length; i++) {
try {
const freedWorkerIdx = await withTimeout(pendingTasks[i], 10)
const freedWorkerIdx = await withTimeout(pendingTasks[i], 100)
idleWorkers.push(freedWorkerIdx)
finishedTasks.push(i)
} catch (e) {
Expand Down Expand Up @@ -679,11 +664,6 @@ const useDecryptionWorkers = ({
timeDifference,
)

console.log({
'Time it took to download blob url':
totalBlobDownloadTime / csvGenerator.length(),
})

resolve({
expectedCount: responsesCount,
successCount: csvGenerator.length(),
Expand Down

0 comments on commit 4dcaa13

Please sign in to comment.