Module resty.cassandra.policies.reconnection.exp

Exponential reconnection policy.

This policy will allow the cluster module to retry an unhealthy node after an exponentially growing delay.

Info:

  • Author: thibaultcha

Functions

new (base_delay, max_delay) Create an exponential reconnection policy.


Functions

new (base_delay, max_delay)
Create an exponential reconnection policy. Instanciates an exponential reconnection policy for resty.cassandra.cluster

Parameters:

  • base_delay number The original, minimum delay for the first reconnection attempt. Futher attempts will grow exponentially from this delay.
  • max_delay number The maximum allowed delay for a reconnection attempt.

Returns:

    table policy: An exponential reconnection policy.

Usage:

    local Cluster = require "resty.cassandra.cluster"
    local exp_reconn = require "resty.cassandra.policies.reconnection.exp"
    
    local policy = exp_reconn.new(1000, 60000)
    local cluster = assert(Cluster.new {
      reconn_policy = policy
    })
generated by LDoc 1.4.6 Last updated 2022-05-20 11:10:11