Improved performance for large download queues

This commit is contained in:
Geomitron
2021-04-08 18:16:36 -05:00
parent 8a68b7dbbe
commit 592a237cfd
4 changed files with 22 additions and 25 deletions

View File

@@ -19,7 +19,7 @@ class DownloadHandler implements IPCEmitHandler<'download'> {
}
private addDownload(data: Download) {
const filesHash = data.data.driveData.filesHash
const filesHash = data.data.driveData.filesHash // Note: using versionID would cause chart packs to download multiple times
if (this.currentDownload?.hash == filesHash || this.downloadQueue.isDownloadingLink(filesHash)) {
return
}

View File

@@ -4,7 +4,7 @@ import { emitIPCEvent } from '../../main'
export class DownloadQueue {
downloadQueue: ChartDownload[] = []
private downloadQueue: ChartDownload[] = []
isDownloadingLink(filesHash: string) {
return this.downloadQueue.some(download => download.hash == filesHash)