b1e992ba

By: Michael Lynch <git@mtlynch.io>

Centralize media publication

Extract the process-then-insert-then-redirect orchestration out of
handlers/upload.go into a new media.Service, so handlers depend only on a
two-method MediaPublisher interface instead of constructing MediaItems and
calling the store directly. Keeps the load-bearing comments explaining why
files are written before the DB row (orphaned files vs. broken gallery
entries) and the EXIF PublishTime TODO, and drops the redundant media-type
validation in PublishImage since uploads.ProcessImage already rejects
unsupported types.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 3s 3s 3s 6s 3s
Eval 7s 19s 19s 27s 1s
Build 23s 4m40s 3m11s 3m35s 1m21s
Suite 3s 5m02s 3m31s 3m35s 1m26s

Timeline

0s10s20s1m50s2m2m10s2m20s2m30s2m40s2m50s3m3m10s3m20s3m30s