The scale-down that kills a job mid-flight

An autoscaler removing a worker sends a termination signal, and a worker that does not handle it loses whatever it was doing.

[Service]
ExecStart=/usr/bin/php artisan queue:work --max-time=3600
KillSignal=SIGTERM
TimeoutStopSec=180        # > the longest job

# and the three numbers that must be ordered:
#   job timeout  <  worker stop timeout  <  orchestrator
#                                            grace period
# getting them out of order kills a worker that was
# cleanly abandoning a job.

Scaling down is the case nobody tests, because scaling up is what gets demonstrated. The grace period has to accommodate the longest job, which means a slow job makes every scale-down slower — and splitting long jobs into chunks is the change that makes the whole arrangement responsive rather than tuning the timeouts.