Commit 5599d2a
Limit OG image generation concurrency (#47)
* Limit OG image generation to 2 concurrent goroutines
Under heavy crawler traffic, unbounded OG generation goroutines were
constantly contesting the SQLite write lock, starving the pipeline.
Non-blocking semaphore skips generation when at capacity — the image
will be generated on the next visit instead.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Move OG semaphore to call site to prevent goroutine churn
Acquiring the semaphore before spawning the goroutine ensures excess
requests under crawler spikes don't create unbounded goroutines that
immediately exit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b71d4f5 commit 5599d2a
1 file changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
223 | 227 | | |
224 | 228 | | |
225 | 229 | | |
226 | | - | |
227 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
228 | 239 | | |
229 | 240 | | |
230 | 241 | | |
| |||
0 commit comments