Reorder file collection and download link processing in GetFileDownlo…
Fixed problem with torbox download routines causing Post-Download Action: Download to never complete.
The issue #123 tagged to this PR was already closed. I don't know what this fixed and how.
The changes don't really resolve anything, really...
The deadlock occurs because the goroutines send to linkCh before filesCh, but the collecting loops process filesCh before linkCh. This causes goroutines to block on sending to the buffered linkCh (filling its capacity), preventing them from sending to filesCh or calling wg.Done(). The collecting loops then hang waiting for items or closure.
To fix this I reordered the collecting loops in GetFileDownloadLinks to match the send order in the goroutines: collect from linkCh first, then filesCh, then errCh. This ensures sends unblock in sequence without deadlock.
I tested with the current v1.1.3 release and the downloads get stuck and never fully download. With this re-ordering, I am able to see downloads finish and leave the list.
I can concurr that this change is needed and I tested it.
@sirrobot01 do you think this was related to the streaming issues that I was having with TorBox? I was able to stream for a bit, but then streaming stops working until I restart Decypharr.
It would be nice to get this pull request in so that we can take later versions of decypharr with torbox.
@sirrobot01 do you think this was related to the streaming issues that I was having with TorBox? I was able to stream for a bit, but then streaming stops working until I restart Decypharr.
Having this problem as well.