# ExponentialReconnectionPolicy

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>
            <span class="ancestors"><a href="index.html">policies/reconnection</a>~</span>ExponentialReconnectionPolicy<span class="signature">(baseDelay, maxDelay, startWithNoDelay)</span><span class="type-signature"></span></h2>
        
    
</header>


    
        

    

    
    <h4 class="name" id="ExponentialReconnectionPolicy"><span class="type-signature"></span>new ExponentialReconnectionPolicy<span class="signature">(baseDelay, maxDelay, startWithNoDelay)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>A reconnection policy that waits exponentially longer between each
reconnection attempt (but keeps a constant delay once a maximum delay is reached).</p>
<p>A random amount of jitter (+/- 15%) will be added to the pure exponential delay value to avoid situations
where many clients are in the reconnection process at exactly the same time. The jitter will never cause the
delay to be less than the base delay, or more than the max delay.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>baseDelay</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The base delay in milliseconds to use for the schedules created by this policy.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>maxDelay</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The maximum delay in milliseconds to wait between two reconnection attempt.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>startWithNoDelay</code></td>
            

            <td class="type">
            
                
<span class="param-type">Boolean</span>


            
            </td>

            

            

            <td class="description last"><p>Determines if the first attempt should be zero delay</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/policies/reconnection.js#L72" target="_blank" rel="noopener">policies/reconnection.js, line 72</a></p></div>




















    
    

    

    

    

    

    

    

    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="_addJitter"><span class="type-signature"></span>_addJitter<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Adds a random portion of +-15% to the delay provided.
Initially, its adds a random value of 15% to avoid reconnection before reaching the base delay.
When the schedule reaches max delay, only subtracts a random portion of 15%.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/policies/reconnection.js#L110" target="_blank" rel="noopener">policies/reconnection.js, line 110</a></p></div>




















        
            

    

    
    <h4 class="name" id="getOptions"><span class="type-signature"></span>getOptions<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Gets an associative array containing the policy options.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/policies/reconnection.js#L135" target="_blank" rel="noopener">policies/reconnection.js, line 135</a></p></div>




















        
            

    

    
    <h4 class="name" id="newSchedule"><span class="type-signature"></span>newSchedule<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
    

    



<div class="description">
    <p>A new schedule that uses an exponentially growing delay between reconnection attempts.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/policies/reconnection.js#L84" target="_blank" rel="noopener">policies/reconnection.js, line 84</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>An infinite iterator.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Object</span>


    </dd>
</dl></div>
