mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-25 22:11:17 +00:00
Searches and downloads share one IRC connection and run side by side, which broke in three ways: - wait_for_dcc took the first search-results file to arrive, so a late file for an earlier query was cached under the current one. It now skips a results file whose name is for a different query. - A download failing on the shared socket closed it under a search in flight. The search then cached an empty answer, hiding the book for a day. Searches and downloads now hold one lock for the whole exchange. - A search that lost its connection returned [] and counted as a no-match pass, pushing the request into backoff. It now raises SourceUnavailableError, which auto-download already treats as an error, and caches nothing. This was written with AI assistance. I reviewed the changes and ran the tests above and verified that this fixed my issues with searching and downloading using IRC. *Generated with Claude Sonnet 5.5* <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Search results are matched against the requested title, ignoring punctuation and accents while rejecting partial-title matches. Filenames without the usual suffix are also recognized. * Results and “no results” notices from earlier searches are skipped, and denied searches report an error. * Connection drops and DCC read errors are reported as failures rather than empty results or timeouts. * Repeated identical searches are rate-limited before sending, and search time limits apply while waiting for results or downloads. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: CaliBrain <calibrain@l4n.xyz>