Operating Systems
Bug Report
Overlapping cron runs corrupted our export file: fixing it with flock and atomic rename
A five-minute cron export started taking six minutes as data grew. Two runs then wrote the same CSV at once, and a partner rejected a file with mangled rows. We serialised the job with flock, bounded it with timeout, and published the file with an atomic rename.