Skip to content

Processing: redrawn bases charged, credit checks count pages, billing hears every finish (#199 leftovers) - #218

Merged
ndbroadbent merged 2 commits into
mainfrom
processing-leftovers
Dec 4, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
processing-leftovers

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Leftovers from #199's review.

  • Redrawn bases charged: when a document's head renders differently (another engine, DPI or renderer version), its base is drawn again with the head's settings. That render is made by the head's build, but none of the build's snapshots points at it, and the charge query counted only renders its snapshots point at, so those pages were never charged. It now counts every render the build made (made_by_build_id); renders handed to another build when this one stops are reassigned as before. Test: a_build_pays_for_the_base_it_drew_again, which fails on main (rendered_pages: 0).

  • The credit check counts pages: the part-way check ran every 200 snapshots, so a build of long documents could compare thousands of pages past its credits. It now counts pages: a document counts one per page of its render, everything else one. A build overruns by at most 200 pages plus the document that crosses the line. No new test: the existing part-way test covers screenshots, and a document version needs rendered fixtures. Happy to add one if you want it.

  • finished(): it returned early when BuildChanged's dispatch failed (a forge that's down), so CreditsSpent (the low-credit emails, automatic packs) never ran. Both run now, and the first error is returned.

  • Test pools (sc-9385): each test's pool holds at most 4 connections (DB_MAX_CONNECTIONS in app::testing::configure). The suite is one binary whose tests boot at once, each with a pool of up to 10, and on the build pool tests failed at boot with "pool timed out" three times on 4 Dec. The full suite passes twice in a row locally with 4.

No visual changes.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… billing hears a build finish even when its check fails (#199)

- A document's base drawn again with the head's settings is a render the build made that none of its snapshots points
  at; the charge counted only renders its snapshots point at, so those pages were never charged. It now counts every
  render the build made.
- The part-way credit check ran every 200 snapshots, so a build of long documents could compare thousands of pages
  past its credits. It now counts pages (a document's from its render).
- finished() returned early when BuildChanged's dispatch failed (a forge that's down), so CreditsSpent (low-credit
  emails, automatic packs) never ran. Both run now, and the first error is returned.
The suite is one binary whose tests boot at once, each with its own pool of up to 10: a CI runner's threads asked
Postgres for more than its 100 connections, and tests failed at boot with "pool timed out".
@ndbroadbent
ndbroadbent merged commit e2b7db5 into main Dec 4, 2026
16 checks passed
@ndbroadbent
ndbroadbent deleted the processing-leftovers branch December 4, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant