Closed 7shi closed 3 months ago
The number of simultaneous connections was raised from 5 to 10 after confirming stable operation.
In very rare cases, download detection may fail. In that case, the download is performed, but the Promise is pending, and the number of running Promises is reduced.
I am investigating and would like to put this pull request on hold. My apologies.
The cause has been identified. Sometimes the Promise returned by chrome.downloads.download()
does not issue resolve
nor reject
when an error occurs. (not always an error)
This should happen not only in my code. I will try to implement a timeout as a workaround.
I am testing this implementation. The timeout works and no longer stalls after about 3000 consecutive downloads of files.
I will test with a much larger volume, tens of thousands of files.
I have modified it so that it is not fatally slow even with tens of thousands of downloads and confirmed that it works fine.
The main points are.
chrome.downloads.download
so it can await
to completion like the fetch API.
id
is not returned.id
.maxConnections
variable.The interface is backward compatible, so it works just by replacing it. Use of split transmission is optional.
Points of behavior change.
These are to avoid the browser becoming so heavy that it affects system operation.
Note: To download hundreds of courses in batch mode, coursedump2022.js
also needs to be modified to limit the number of simultaneous connections, but this is out of the requirements for this pull request, so it is excluded here.
Thank you for all the work, that is quite a lot of changes. I wasn't feeling well last week, so I couldn't get to reviewing and merging it at the time, but I will try to do this in the coming days.
When a large number of files are downloaded in a batch download, the download cannot keep up and a large number of files accumulate in the queue, causing an abnormal load. In my environment, the mouse pointer did not even move properly. The script stopped working when the number exceeded 12,000.
Therefore, the number of simultaneous downloads is limited to
51015. This can be adjusted by changing the value of the variablemaxConnections
.Since the download status is monitored, the timing of the
done
notification is also at the same time as all the downloads are completed.