Counting the files waiting to download reads an index of them alone (#489)

Db::counts counted enclosures WHERE state = 'pending' with no index to
use: a parallel sequential scan of all ~690,000 rows in production, 92 ms
and 32,397 buffers, every 30 s for /metrics and on each /api/status, to
find a handful. It was the slowest route at p95 and once 1.1 s. A partial
index on the pending rows makes it an index-only count of those few, as
enclosures_on_disk already does for the downloaded count beside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RqkrVBuJRne2JAhFpaDV2U
This commit is contained in:
2026-11-22 08:54:42 -05:00
parent 8afa79b022
commit 33b595973a
2 changed files with 4 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Counting the files waiting to download, which the status and the metrics do every 30 seconds, reads only those files instead of every one ipx knows of: about 1 ms instead of 90 (#489).
- Downloading a season takes back the files of it retention removed, rather than queuing nothing, and no file on its way already is queued twice (#483).
- A feed an OPML stops listing leaves All Subscriptions with it, rather than its items staying there with no feed name beside them: the scan no longer reads it again after the list drops it, and its subscriptions go with it, as they do when a feed is removed with `ipx rm`. Any left from before are removed when ipx starts (#478).
- Searching All Subscriptions answers in a fraction of a second, not five: a search reads each item's title and text without its markup, indexed on Postgres, and still finds part of a word. It no longer matches words inside the HTML's tags, such as a link's address. Text past the first 4,000 characters of a very long post is not searched (#459, #472).