Fixes #718
Supersedes the approach of #568 (BuddySan, closed in May after review), ported to the current code and with the tests the review asked for.
Problem
The add modal's Search for downloads immediately option sends autoSearch: true, but nothing acts on it. LibraryAddService / LibraryAddWorkflow only log it:
LibraryAddService: Added audiobook 'Bazaar' (ASIN: B07YVHJKSX) to library with Monitored=False, QualityProfileId=1, AutoSearch=True
and no search follows. The book then waits for the six-hour automatic sweep, which only searches monitored books, so an unmonitored book added with this option is never searched at all.
Change
After a successful add with AutoSearch, LibraryAddWorkflow runs the same IDownloadService.SearchAndDownloadAsync as the Wanted page's search button, on a background task in its own DI scope, so the add response does not wait on indexers. It covers both add paths (with and without ILibraryAddService). Nothing runs on a conflict (already in the library) or a validation error, and a failed search is only logged: the add itself is already committed.
The defaults are unchanged (the option stays unticked unless the user ticks it), unlike #568, to keep this to the bug.
Why it does not depend on Monitored
This answers the question raised on #568: should the immediate search also require Monitor for new releases?
In the modal, Search for downloads immediately sits at the same level as Monitor for new releases, not under it as a sub-option, and they mean different things:
- Search for downloads immediately: look for available downloads now, once, with the current quality profile and the usual scoring of the actual search results.
- Monitor for new releases: keep searching later, including for upgrades.
So ticking the first one should start searching right away whether or not the book is monitored. An unmonitored book is then grabbed once and not upgraded after...
Automated Canary build