lazylibrarian / LazyLibrarian

195 stars 34 forks source link

Bug: snatches don't time out and fail according to the task_age setting #42

Closed dsm1212 closed 2 years ago

dsm1212 commented 2 years ago

Ok, so this is maybe something I just need clarification on. Debug log shows post processing is looping over a bunch of invalid hashes sent to qbittorrent. I actually have nothing downloading or seeding at the moment. Even more oddly it sometimes mentions a torrent name that was sent to qbittorrent by other programs (couchpotato and medusa). Ignoring that oddity I'm guessing these are things i stopped seeding before LL processed them. They must have gotten into some lazylibrarian database table that I need to clean up?? I'd like to just clean out all outstanding downloads since I know there are none at the moment, is there table I can truncate or a UI I'm missing that I should use?

Config: Repo: https://gitlab.com/LazyLibrarian/lazylibrarian : Branch: master : Updated: Wed Dec 1 21:05:54 2021 Current Version: c7ce74729e3072ee2eccaec98bb966666ea2a380 : Latest Version: c7ce74729e3072ee2eccaec98bb966666ea2a380

Log loops over many unrelated torrents and hashes like this:

2021-12-01 22:02:05 DEBUG POSTPROCESS qbittorrent.py _command 175 QBitTorrent webUI raised the following error: Not Found 2021-12-01 22:02:05 DEBUG POSTPROCESS qbittorrent.py _command 174 Failed URL: http://localhost:4545/api/v2/torrents/files?hash=332c56d47ac326c33a3faa8c52d413d00a31d96f 2021-12-01 22:02:03 DEBUG POSTPROCESS qbittorrent.py _command 175 QBitTorrent webUI raised the following error: Not Found 2021-12-01 22:02:03 DEBUG POSTPROCESS qbittorrent.py _command 174 Failed URL: http://localhost:4545/api/v2/torrents/files?hash=332c56d47ac326c33a3faa8c52d413d00a31d96f 2021-12-01 22:02:01 DEBUG POSTPROCESS qbittorrent.py _command 175 QBitTorrent webUI raised the following error: Not Found 2021-12-01 22:02:01 DEBUG POSTPROCESS qbittorrent.py _command 174 Failed URL: http://localhost:4545/api/v2/torrents/files?hash=332c56d47ac326c33a3faa8c52d413d00a31d96f 2021-12-01 22:01:59 DEBUG POSTPROCESS qbittorrent.py _command 175 QBitTorrent webUI raised the following error: Not Found @dsm1212

dsm1212 commented 2 years ago

Looked at the code a bit. I have the task duration set to 24 hours. It looks like when postprocessor runs it should delete any snatches older than 24 hours and turn them back to wanted, but they are not. I suspect this was somehow caused by my deleting things in qbittorrent that were not making progress. There is definitely some required resilience to not finding a torrent that just isn't started yet, but I think this task timeout should cull them and I have a bunch just hanging around. Was a lot easier to debug things like this when not using docker. Any suggestions?

dsm1212 commented 2 years ago

So I filtered the book list by snatched and then looked at what was in qbittorrent. All the items which were missing I modified to Skipped. So that cleans this up for me, but I also grabbed the db and opened it in sqlite3. I notice that even the snatches still in progress have an nzbdate in the wanted table which is > 24 hours. So I think the mechanism for timing out the snatches is not working. At least for me using qbittorrent. So I will change the title to bug instead of question.

dsm1212 commented 2 years ago

Ah, I see what the bug is. Line 792 of postprocess.py pulls "seconds" as td.seconds to use as the diff. But that is just the seconds component of the time difference. If you want the total time difference in seconds, then line 792 should use td.total_seconds(). I'm sorry I would fix and push a PR but I don't have time. Please take a look.

dsm1212 commented 2 years ago

Ah, LL is on gitlab now. Closing this.