7ebce793

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 1s 22s 22s 24s 1s
Eval 16s 1m41s 1m41s 1m58s 0s
Build 1m39s 7m10s 2m29s 4m08s 0s
Suite 1s 9m14s 4m06s 4m08s 1s

Timeline

0s20s40s1m1m20s1m40s2m2m20s2m40s3m3m20s3m40s4m