jeff-hughes / shellcaster

Terminal-based podcast manager built in Rust
GNU General Public License v3.0
199 stars 13 forks source link

Downloads failing #45

Closed lacamar closed 2 years ago

lacamar commented 2 years ago

After updating to the new release I get an error whenever I try to download a podcast ("Error downloading podcast"). The files begin downloading for about 15 seconds and then fail. If the file downloads within ~15 seconds it works normally. I have tried rebuilding from source with the native_tls feature but that didn't seem to help.

jeff-hughes commented 2 years ago

Hi there, thanks for raising this -- I haven't run into this issue myself, but when upgrading the request library (ureq) there were some changes to the timeout feature that I think I may not have properly dealt with. In previous versions, I had the timeout set to only cover the time to connect to a socket, and there was no timeout related to the time to read from the socket. In the newer version of the ureq library, they moved where that was set, and I didn't notice that until just now. So it looks like the timeout now covers the entire connection-and-download process.

However, the current timeout set in the code is 30 seconds, so I'm not sure why you're seeing failure after 15 seconds. That means it's possible it's not a timeout issue at all. But either way, I'll try to push an update later today and we can see if that resolves things.

lacamar commented 2 years ago

Thanks for the quick patch. I have installed the new update now and unfortunately the issue is still there. I have measured the time it takes to time out with the error and it's exactly 30 seconds, so it sounds like it probably is related to the ureq library. Is there anything I can do from my end to help debug this?

jeff-hughes commented 2 years ago

I think you misunderstood -- I haven't patched anything yet! I'll let you know when I've pushed it. But it's good to know that it is 30 seconds, so thanks for confirming that.

lacamar commented 2 years ago

Ah whoops, all good. I ran my package manager after seeing your reply and it rebuilt shellcaster so I just assumed it had been patched.

jeff-hughes commented 2 years ago

Alright, I just pushed v2.0.1, so give that a try and let me know if it fixes the issue. I increased the timeout so it will wait for up to 10 seconds to connect, and up to 2 minutes to complete the download. I don't want to completely eliminate the timeout or it could potentially hang indefinitely, but hopefully 2 minutes is long enough for most downloads regardless of your Internet connection.

lacamar commented 2 years ago

Looks like it's working now, thanks! I have been using shellcaster for video RSS feeds as well as audio and those files can take a long time to download, so some way of keeping download time uncapped would be ideal. Users with limited bandwidth may also need that time for long audio files. As it stands, this fix lets me continue downloading long past the 2 minute mark, so it's working how I would like it.

jeff-hughes commented 2 years ago

Hmm, yeah that's a good point that video feeds are generally going to have larger file sizes. I guess it's frustrating when a download fails after 30 seconds -- and it's even more frustrating when it fails after 2 minutes! I don't want to negatively impact anyone on slower connections.

At any rate, I'm glad I could at least solve the immediate problem for you. So I'll close the issue, but I've made a note to myself to just remove the timeout on downloads entirely for the next release.