tonikelope / megabasterd

Yet another unofficial (and ugly) cross-platform MEGA downloader/uploader/streaming suite.
GNU General Public License v3.0
4.57k stars 595 forks source link

Reduce waiting time for external command after HTTP Error 509 Bandwidth Limit Exceeded #507

Open tomyummmm opened 1 year ago

tomyummmm commented 1 year ago

Hi,

Currently after reaching the 5GB bandwidth limit, it takes 10 minutes before triggering the external command again. In my case, the command is to reconnect and change my VPN server, so it can continue downloading. Is it possible to reduce this wait time to maybe 1 minute instead or remove it?

pwsh -NoProfile -command "C:\Program` Files\NordVPN\NordVPN.exe -c -g Singapore"

https://github.com/tonikelope/megabasterd/blob/ee5a5a788d29adf1ff2866b97c12998e425684b4/src/main/java/com/tonikelope/megabasterd/ChunkDownloader.java#L183-L187

https://github.com/tonikelope/megabasterd/blob/ee5a5a788d29adf1ff2866b97c12998e425684b4/src/main/java/com/tonikelope/megabasterd/MainPanel.java#L77

https://github.com/tonikelope/megabasterd/blob/ee5a5a788d29adf1ff2866b97c12998e425684b4/src/main/java/com/tonikelope/megabasterd/MainPanel.java#L867-L881

tonikelope commented 1 year ago

Hi

RUN_COMMAND_TIME is the time to wait between each call to the external command. The first call occurs immediately after receiving a 509 error, but to give the external application time to do its thing (in this case, change the VPN server) before launching the command again, a time limit is set. In the next update I will put the option to modify this parameter in advanced settings.

tomyummmm commented 1 year ago

Maybe I am misunderstanding, because I have very fast internet speeds, so 1st 509 error, run_external_command is called, after about 1 minute for the VPN to change server, it starts downloading and normally hits 5GB and error 509 before 10 minutes is up, which causes it to wait until 10 minutes (despite already having error 509 for the second time), then run_external_command is called again?

Having the option modify this would definitely be nice to have, as the external command shouldn't take that long for it to do its thing, maybe change the default to 5 minutes instead?

tomyummmm commented 1 year ago

495 Seems to be talking about the same issue, possibly due to the default wait time being 10 minutes? But I think it would be easier for you as well, if create a README or wiki that explains some of the repeated questions / issues.

shruggle commented 1 year ago

Hi,

I actually came here to ask about this same thing -- or at least something similar. I'm running megabasterd with a vpn as well, and I've noticed that sometimes I'll get a ton of 509 errors, and it doesn't seem to be running the reconnect command (or at least not immediately. It does run eventually if I leave it alone long enough.

If I run the reconnect command manually, the downloads will resume. If there's any info I can provide to help troubleshoot this, I'd be happy to provide it. (running on ubuntu)

also! tysm for this great program, it works better than any other download client I've tried!

tomyummmm commented 1 year ago

Hi,

I actually came here to ask about this same thing -- or at least something similar. I'm running megabasterd with a vpn as well, and I've noticed that sometimes I'll get a ton of 509 errors, and it doesn't seem to be running the reconnect command (or at least not immediately. It does run eventually if I leave it alone long enough.

If I run the reconnect command manually, the downloads will resume. If there's any info I can provide to help troubleshoot this, I'd be happy to provide it. (running on ubuntu)

also! tysm for this great program, it works better than any other download client I've tried!

As mentioned in the first part, it is due to the hardcoded 10 minute wait time. I have compiled a version with shorter wait time of 5 minutes, and another version with -101 error issue to be fixed here https://github.com/tonikelope/megabasterd/issues/281#issuecomment-1493196668.

You can download the zip file here, just rename either of the jar files to megabasterd.jar and it should work. https://mega.nz/file/GosynSKZ#WGuJn4JvHV3dPGWSCayMLMWHtKcqeCcnLXXxobHQvpw

Alternatively, you can clone the repo, open the project in IntelliJ IDEA, edit the line 77 i mentioned to whatever wait time you want, Build the project, then build artifact .jar to get the same result.