Spec a Go worker pool that shuts down cleanly

Vibe codingHard25 min

Your task

Your Go service reads thumbnail jobs from a stream and renders them. It runs on Kubernetes, which sends SIGTERM at every deploy and kills the pod 30 seconds later. Some jobs vanish at each deploy, and memory climbs when the stream bursts. A coding agent will rewrite the worker pool.

Write the spec you would hand the agent.

What you know:

  • jobs come from Source.Next(ctx) (Job, error), and a job leaves the stream only when you call job.Ack()
  • an unacked job goes back to the stream after 60 seconds, and after 5 deliveries it moves to a dead-letter queue
  • a render takes 1 to 8 seconds, and 8 renders at once fill the pod's CPU
  • each render writes one PNG to object storage

Then, in a few sentences: what does "write a goroutine worker pool" usually get wrong?