Tenacity
August 28, 2024
Last week, I achieved a breakthrough in the development of my QR Card generator, a solution that creates decks of easy-to-use printed cards designed for attendants, concierges, and event staff.
That doesn't mean the system is perfect -- yet.
I found a glitch in the card generation engine, just at the point where my Azure Function App sends images to Azure Storage.
Ninety-eight percent of the time, it works fine, but that means there's a misfire in just about every 52-card deck.
I went into the code, found the problem spot, and added retry logic using the tenacity module in Python.
With tenacity, you can retry any block of code as many times as you like: Retry every two seconds for the next 10 tries, or using exponentially longer wait periods for five minutes, or with "jitter" added to the interval so that it's not entirely regular.
Through experimentation, I was able to reduce the failure rate from 2% to 0.5%.
That's probably good enough. It's easy enough to find the exceptions and manually create the missing cards.
But it would be ideal to get to 0.00001% (which is 0.99999% success rate, or "five nines").
Maybe I can get there by tinkering with the retry logic.
Or I can implement a queue as part of the Azure Function App, thus continuing my journey to becoming a professional software developer.
Or I could refactor the code to bring the connection with Azure Storage back into the reliable, industrial-strength codebase of Power Automate.
Except that I have other things to do.
In an MBA leadership class, we were asked to imagine being lost in the desert. Then, we were given a list of 15 items that may aid in our survival. Our task was to rank them in order from most to least important.
Starting a company is akin to that survival exercise. You have a long list of things that you could be doing and it's impossible to do all of them. You're forced to choose which items are most important.
Here's my list*.
-
Write documentation. If I must come back to it later, I'd better write down what I'm doing now.
-
Finish the website. There's no product without it.
-
Work on the demo deck. There's no sales pitch without it.
-
Record explainer videos. It's easy to understand when you see it in action.
-
Share the video and demo. Start getting people interested.
-
Meet with prospects. Get early customers.
-
Run PR and promotional campaigns. Spread the word.
-
Go live. Let's get it started.
-
Fix bugs. Maybe I should put this earlier.
-
Find speaking opportunities. Get the story in front of audiences.
-
Set up the DevOps pipeline. Power Platform makes this easy.
-
Build the management dashboard. Power BI makes this very easy, but I'll need to do it with actual customers.
-
Add new features. Guided by customer feedback.
-
Find new use cases. Guided by imagination.
-
Publish an API. Now we're cooking.
*Not included: Write these weekly newsletter posts, which I consider essential.
The point of the leadership exercise was this: Your choices and the group's choices are going to be different.
If you have a functional group, the group's choices are going to be better.
If you're reading this, you're one of the smartest people I know.
That's why I'm asking you:
How would you rank the 15 items?
What's missing from the list?