The woes of coding by assumption
In a project we have a scheduler type service that polls an Azure Queue for work and does it, e.g. sending some emails. I've been confused about our number of storage transactions ever since I joined the project. It was at least 100 times more than my back of an envelope calculation estimated there should be. I installed Application Insights to try it out and, after I published, it informed me that one of the apps (the scheduler) was sending 250+ requests per second to Azure Queues. What the hell right? I took at look at the code and it was the sort of thing I was expecting: void Start() { _timer = new Timer(PollQueue, null , _queuePollingInterval, Timeout.Infinite); } void PollQueue( object state) { // check the queue for new work and do it. if (_timer != null ) _timer.Change(_queuePollingInterval, Timeout.Inifinte); } All looks good right? The entry point called Start() which in turn sets up a timer to called PollQueue(null) after the specified _queuePo...