comicbox.online_estimate ¶
Estimate the API-request count and wall-clock for a batch online-tag run.
A batch caller (Codex) shows this to an operator before a “Tag Online” run and mirrors it in a live countdown. Keeping the model here — next to the search flow it describes and the rate limits it divides by — means the numbers move with comicbox’s behavior instead of drifting in a downstream copy.
The model is deliberately simple. Per comic, each source costs a characteristic number of API requests:
- Metron resolves an issue with a single
issues_listsearch plus the final issue fetch — a flat count (see v4.0.5 / PR #143; no series-discovery step since series ids land directly on issue-list results). Metron does not fan out, so effort does not move it. - Comic Vine discovers volumes, asks each surviving candidate for its issues, then fetches the issue it accepts. Only the middle step varies:
Effortdecides how many candidates are worth a call. - VerseDB searches series, lists the issues of every surviving series in one call, then fetches the issue it accepts — a flat count, like Metron’s. Its free tier’s 300/hour cap paces it; the 4,000/day cap is not modelled, as no source’s daily cap is.
Match mode is not an input. It decides how a verdict is applied, never how many requests a search spends.
Under first-match-wins a comic stops at the first source that answers, so the run is billed the costliest single selected source; merging all sources (first_wins=False) queries every source per comic, so their per-comic costs are summed.
Wall-clock paces each source at its sustained throughput: Metron’s per-minute cap binds a bounded run directly. Comic Vine limits per resource pool — 200/hour for each endpoint (simyan keeps a separate bucket per endpoint, mirroring CV’s documented “200 requests per resource per hour”) — so a run is bound by its busiest single pool, not by the request total: discovery and the final fetches each land in their own pool while the per-volume issue lookups stack in one. first-match-wins means a comic isn’t done until the binding source answers, so the slowest source sets the pace; merging pays every source per comic, so their paces sum.
The projection prices a cold search for every comic. A real run batches by series, where one search answers for the whole series and the issues after it cost about one issue-list call each, so a library finishes ahead of this number. Each call counted here is one HTTP request: simyan 4.1.0 stops paginating on a short page, so a Comic Vine list call no longer spends two of its pool’s hourly budget (Simyan#309, see tasks/simyan-4-plan.md).
RunEstimate dataclass ¶
The projected cost of a batch online-tag run.
Source code in comicbox/online_estimate.py
145 146 147 148 149 150 151 152 | |
estimate_run(comics, sources, *, effort=Effort.BALANCED.value, merge_all_sources=False) ¶
Project the request count and wall-clock seconds for a batch online-tag run.
comics is how many comics remain to look up and sources the enabled source names in priority order. effort is an :class:~comicbox.config.online.settings.Effort value ("balanced" etc.), resolved for the source it prices. merge_all_sources mirrors first_wins=False: every source is queried per comic and their per-comic costs summed, instead of stopping at the first match.
The projection assumes the effort it is handed. A CLI run can auto-engage a lower Comic Vine effort for a large unattended batch, which this cannot see.
Source code in comicbox/online_estimate.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
metron_requests_for_batch(comics, series) ¶
Return what a Metron batch of comics over series runs costs.
The per-comic constant prices a comic that resolves its own series. That is the right number for a scattered batch and badly wrong for a library-scale one, where one series answers for a hundred comics: each series pays the cold price once and every other comic of it pays the warm price.
series is how many distinct series the batch spans — the CLI and OnlineSession.tag_many both count them to decide prefetching, so the caller has the number already. Clamped into range, since a batch cannot span more series than it has comics.
Source code in comicbox/online_estimate.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
requests_per_comic(source, effort=Effort.BALANCED.value) ¶
Return the API requests one comic costs against source at effort.
effort is an :class:~comicbox.config.online.settings.Effort or its value. Resolve it for the source it prices — resolve_effort(settings.online, "comicvine") — because a per-source override beats the global setting.
Source code in comicbox/online_estimate.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
source_rate_per_minute(source) ¶
Return the pace to project a run at, preferring the server’s number.
SOURCE_RATE_PER_MINUTE holds documented starting points. Metron sends its real per-user burst limit on every response, and comicbox’s rate gate paces against that, so once anything has talked to Metron in this process the gate’s number is the one a projection should use — a self-hosted instance or a changed server setting makes the constant simply wrong.
Source code in comicbox/online_estimate.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |