I would like do retry if I fail to connect to database.
My requirement is
- retry 5 times at most and sleep 5 second then retry again
- Sets the delay between retries (i.e. 5 seconds), exponentially backing off to the maxDelay (i.e. 120 seconds) and multiplying successive delays by the delayFactor (i.e. 2).
Here has the sample code: