Skip to content

Move OG image generation from request handler to pipeline#48

Open
swalkinshaw wants to merge 1 commit intomainfrom
og-generation-refactor
Open

Move OG image generation from request handler to pipeline#48
swalkinshaw wants to merge 1 commit intomainfrom
og-generation-refactor

Conversation

@swalkinshaw
Copy link
Member

Remove on-demand OG generation from the HTTP handler to eliminate SQLite write contention under crawler traffic. New packages get their OG images generated during the pipeline run (after build, before deploy). The daily batch job continues to handle regeneration when install counts change.

  • Remove OG image generation from handler entirely
  • Add GenerateNew() for first-time OG generation only
  • Add ImageRenderer function type for testability
  • Fix SQLite deadlock: collect rows before writing (open cursor + write)
  • Remove unused MarkOGGeneratedBySlug

Remove on-demand OG generation from the HTTP handler to eliminate
SQLite write contention under crawler traffic. New packages get
their OG images generated during the pipeline run (after build,
before deploy). The daily batch job continues to handle regeneration
when install counts change.

- Remove ogSem semaphore and generatePackageOG from handlers
- Add GenerateNew() for first-time OG generation only
- Add ImageRenderer function type for testability
- Fix SQLite deadlock: collect rows before writing (open cursor + write)
- Unexport internal helpers (markOGGenerated, getPackagesNeedingOG)
- Remove unused MarkOGGeneratedBySlug

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@swalkinshaw swalkinshaw requested a review from retlehs March 20, 2026 03:33
@swalkinshaw
Copy link
Member Author

@tangrufus alternative to semaphore and rate limiting since we shouldn't even expose the on-demand image generation imo. This does it all at build time

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