Using the retry.lua module

Introduction

Use the retry.lua module for retrying operations which are prone to periodic failure. For example: You can retry database operations, or network connections.

You should use retry for errors that indicate transitory problems which can be overcome with enough retries. However other errors can be more serious and may want to stop the interface instead. Fortunately using Iguana gives you complete control over identifying errors and implementing your desired response.

This page presents the Lua retry module by itself, so you can copy it directly into your project. However if you prefer to experiment with some sample code that uses the retry module then you should consider importing the Retry periodic failure channel from the Builtin: Iguana Tools repository.

Code for the retry.lua module [top]

This is retry module from our Retry periodic failure channel in the Builtin: Iguana Tools repository.

Using retry.lua [top]

The module contains the retry.call() function for retrying operations which might periodically fail like database operations.

How to use retry:

  1. Add it to your shared modules in any Translator project.
  2. Use  local retry = require 'retry' at the top of your script.
  3. Use the retry.call() function to retry your operation.

More Information [top]

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.