ManiMatter / decluttarr

Watches radarr, sonarr, lidarr, readarr and whisparr download queues and removes downloads if they become stalled or no longer needed.
GNU General Public License v3.0
100 stars 15 forks source link

Possible to restart container on missing qbittorrent connection #18

Closed JimmyHoenderdaal closed 6 months ago

JimmyHoenderdaal commented 6 months ago

Hi there, My Decluttarr container doesn’t restart when it can't connect to qbittorrent. Every time my server restarts both start at the same time, but Decluttarr gives errors like:

2023-12-12 12:33:48
 [WARNING]: >>> Queue cleaning failed on Radarr. (File: queue_cleaner.py / Line: 227 / Error Message: 'NoneType' object is not iterable / Error Type: )
2023-12-12 12:43:48
 [ERROR]: Error making API request to http://qbittorrent:8080/api/v2/torrents/info: 403 Client Error: Forbidden for url: http://qbittorrent:8080/api/v2/torrents/info?tag=keep

Is it possible to make Decluttarr restart itself when it can't connect with qbittorrent? Right now I’m doing it manually, which does work. I have my container set as "Restart unless stopped" so I think simply setting the container as failed on these errors should resolve my problem.

You can reproduce this by starting both containers and then restarting the qbittorrent container.

Thanks!

ManiMatter commented 6 months ago

I use restart: always

Does that solve it for you?

JimmyHoenderdaal commented 6 months ago

No, tried different restart policies but it has the same error after running a while. Just looks like whenever qbittorrent loses connection it doesn't retry to connect to it again. Might also be because of docker networks since its linked to eachother. I can try setting the qbittorrent url as http://localhost:8080 instead of the docker container url http://qbittorrent:8080

ManiMatter commented 6 months ago

Not sure I know what's going on. I use "restart: always" and that works perfectly for me.

Do any of these ideas work for you?

ManiMatter commented 6 months ago

hi, did above tips help you or are you still having an issue?

JimmyHoenderdaal commented 6 months ago

Hey there, I'm still facing the issues from time to time. My qbittorrent operates in the same network as my gluetun. Since gluetun gets updated regularly and has to be restarted, I disabled its auto-updates. This tweak seems to have fixed things for now. I reckon what happened was that when Gluetun restarted, it caused my qbittorrent container to break, subsequently leading to issues with my decluttar container, which then needed a restart too. I'll keep an eye on whether keeping the updates disabled improves the situation. Thanks for your help! :)

JimmyHoenderdaal commented 6 months ago

Managed to fix it by using network mode: host and localhost urls instead of linking docker container and using the container urls, eg http://localhost:8080 instead of http://qbittorrent:8080. Seems like container linking isn't that reliable