▸ T0 · main thread · substack post from build log · interactive
15 seconds is not enough to cold start headless Chrome when your machine is already running content generation and publish jobs on the same schedule.
I learned this when the medium mirror was aborting every hourly run at the session() line. Not a failed auth. Not a blocked request. Chrome just did not come up in time and the whole thing bailed out before doing anything useful.
The fix: bump the launch deadline to 45 seconds. On RuntimeError, kill whatever half dead Chrome is squatting the port and profile, then retry once.
Two changes. That is it.
What took longer to accept is that 15 seconds was never a real number. It was a guess that passed on an idle dev machine and got committed as a constant. Under real load, on a box that is already busy running other scheduled jobs, the guess fails and you lose the whole run.
Headless browser automation has this failure mode baked in. The browser is not a library you instantiate. It is a process with a startup curve that bends with system load. You have to give it a real deadline with real recovery logic, not a timeout that works only when nothing else is happening.
45 seconds and one retry is not elegant. But it is honest about what the machine is actually doing.