fix(backend): bound thumbnail generation and decode larger images
Thumbnails/previews are generated lazily per request with no concurrency limit, and the imaging resize already fans out across every core — so scrolling to a handful of large images spawned that many all-core, hundreds-of-MB decodes at once and pegged the server. Add a generation semaphore (THUMB_CONCURRENCY, default = half the CPUs) so only a bounded number run at a time; queued requests wait and re-check the cache. Also raise the decode cap from 64 Mpx to a configurable ~300 Mpx default (THUMB_MAX_PIXELS) so genuinely large photos (e.g. 13000×17000 ≈ 221 Mpx) get a real thumbnail instead of falling back to a placeholder. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,7 @@ func main() {
|
||||
cfg.ThumbsCachePath,
|
||||
cfg.ThumbWidth, cfg.ThumbHeight,
|
||||
cfg.PreviewWidth, cfg.PreviewHeight,
|
||||
cfg.ThumbMaxPixels, cfg.ThumbConcurrency,
|
||||
)
|
||||
if err != nil {
|
||||
slog.Error("failed to initialise storage", "err", err)
|
||||
|
||||
Reference in New Issue
Block a user