Add a delay-before-retry option, with exponential back-off

As the title says, I added an exponential back-off to the retry code.
This handles database max-number-of-connections, restarts, and similar conditions seamlessly.