A pharmaceutical company keeps its Podio CRM in step with an external database of healthcare professionals and the places they work. A scheduled job in Microsoft Azure pulls the changes every night and writes them into Podio. On a normal night that is a few hundred records. A full sync — needed for the first load and after larger changes upstream — touches about 68,000 records and takes several hours.
The problem
Every full sync stopped after roughly an hour. There was no error from the job itself, and its timeout was set to ten hours. Because the job first downloads everything and then writes it in sequence, without a point to resume from, each new attempt started from scratch and stopped at the same moment again.
Finding the cause
Instead of guessing at the code, we read the platform logs. About seven minutes after the timer fired, Azure's scaling service put the instance into "drain" mode. Exactly sixty minutes later it stopped the host.
That matches how the hosting plan works: on Azure's Flex Consumption plan, a running function gets at most sixty minutes of grace once the platform decides to scale in — whatever timeout you configure. The ten-hour setting was never the limit. The hosting model was.
What we changed
- A plan that lets long jobs run. The function moved to a small dedicated App Service plan with "Always On", which is not subject to this kind of scale-in.
- In the infrastructure code, not in the portal. The change went through the company's normal review and deployment pipeline. The old hosting model stays available as a single switch, so it can be reverted.
- Everything else stays the same. Same identity, secrets, storage permissions and schedule. Security settings were tightened on the way: HTTPS only, TLS 1.2, no FTP.
- A clean handover. A Flex app can't be converted in place, so the new app got new names and the old one was retired, leaving deployment exactly one target.
The result
- The full sync of 68,339 records ran for about seven hours and completed — the first time past the one-hour mark.
- A second full pass the next morning completed as well.
- The job is set back to its normal nightly schedule for daily changes.
What we took away
When a long job dies at a suspiciously round number, look at the platform before the code. Serverless plans are great for short bursts; a job that needs hours needs a plan that lets it run for hours.
