fix(telegram): search only on click, stop search floods and lost Telegram sources - #757
Conversation
|
Thanks for working on this! Searching only when requested and reducing Telegram traffic are useful improvements. It merges cleanly, the Play build compiles, and all 22 existing Telegram tests pass. I found three remaining issues to fix before merging:
Please add regression tests for a per-request timeout, non-video first-page results, and reopening after a successful manual search (including Telegram-only). The existing tests don't cover these new paths. I haven't tested this build on a physical TV or live Telegram account. Thanks! |
…eopened Sources - A request Telegram did not answer in time now makes the whole lookup incomplete, so it is never cached as "no results" (the per-request 20s timeout used to look like an empty answer). - When a phrasing's unfiltered first page has more results behind it, the phrasing is repeated with the video and document filters, so newer text or photo posts cannot push the files off the only page read. Pages with nothing behind them still cost one request. - Telegram results found by a click-search are merged into every saved source list that Sources returns (fresh, stale, disk and addon-less paths), so reopening Sources keeps them, including with Telegram as the only provider. - The phrase loop and the result cache moved into TelegramPhraseSearch / TelegramResultCache (no Android dependencies) with regression tests for a per-request timeout, a cut-off first page, and reopening after a click-search (including Telegram-only).
|
@ProdigyV21 thanks for the review! All three are fixed in 4bde881:
The phrase loop and the result cache moved into Android-free classes (TelegramPhraseSearch / TelegramResultCache), with regression tests for a per-request timeout, a first page full of non-video posts, and reopening after a click-search (including Telegram-only). Tested on an Android TV emulator with a live Telegram account: the click-search found all 10 matching files for Special Ops: Lioness S1E1 in about 2s, reopening Sources kept them without a new search, and nothing was cached from incomplete lookups. |
|
Thanks @silentbil for addressing all three review points and adding the regression coverage. I checked the updated changes against current main and added one small follow-up: publish each answered page immediately, so a stalled sibling query or filtered follow-up cannot hide files already found when the overall deadline expires. Request counts and the two-query concurrency limit are unchanged. Both new regression tests reproduced the old behavior and now pass; all 36 focused Telegram tests pass, along with GitHub's full Sideload test build, web/backend tests and web type check. Merged with your original commits and authorship preserved. I have not repeated the live-account/emulator test or tested this on a physical TV. |
Telegram search is rate-limited per account. The app searched it automatically from every source list, firing about 26 requests per episode, so lookups kept timing out, sometimes with a toast over playback.