gelbooru+moebooru: drop background prefetch from search, fetch on demand
Removes the asyncio.create_task(prefetch_batch) calls from
search() and get_post() in both clients. Tags are now fetched
ONLY when the user actually clicks a post (via ensure_categories
in the info panel path) or saves with a category-token template.
The background prefetch was the source of most of the complexity:
probe timing, early-exit bugs from partial composes racing with
on-click ensures, Rule34's slow probe blocking the prefetch
window. All gone.
New flow:
search() → fast, returns posts with flat tags only
click → ensure_categories fires, ~200ms HTML scrape or
batch API, categories arrive, signal re-renders
re-click → instant (cache compose, no HTTP)
save → ensure in save_post_file, same path
The ~200ms per first-click is invisible during the image load.
The cache compounds across posts and sessions. The prefetch_batch
method stays in CategoryFetcher for potential future use but
nothing calls it from the hot path anymore.
This commit is contained in:
parent
7d11aeab06
commit
35424ff89d
@ -81,9 +81,6 @@ class GelbooruClient(BooruClient):
|
||||
created_at=_parse_date(item.get("created_at")),
|
||||
)
|
||||
)
|
||||
if self.category_fetcher is not None:
|
||||
import asyncio
|
||||
asyncio.create_task(self.category_fetcher.prefetch_batch(posts))
|
||||
return posts
|
||||
|
||||
@staticmethod
|
||||
|
||||
@ -56,9 +56,6 @@ class MoebooruClient(BooruClient):
|
||||
created_at=_parse_date(item.get("created_at")),
|
||||
)
|
||||
)
|
||||
if self.category_fetcher is not None:
|
||||
import asyncio
|
||||
asyncio.create_task(self.category_fetcher.prefetch_batch(posts))
|
||||
return posts
|
||||
|
||||
async def get_post(self, post_id: int) -> Post | None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user