DEV Community

Vivek Verma
Vivek Verma

Posted on • Edited on

Failed, TryAgain.... Implement Retry Functionality in your code

If you are a software engineer you must have encountered some piece of code that sometimes work and sometimes doesnot.

Image description

Why do you need Retry

Well, you failed. But don't you worry, You have lot of retries left but it;s good to know what made you fail so you are prepared for it. Even in software word where everything is perdefined, there are lot of factors we can not control. There are sveral reasons a piece of code could fail.

  1. Network Failures
  2. Third Party Failures.
  3. Database opereation failures.

Retry Using Loops

A simple way of retrying is that having the operation in a loop for n times and it comes out of the loop if it is successfull or we can return the error in case if it is not successful


Enter fullscreen mode Exit fullscreen mode

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More