class Rosegold::ReconnectPolicy

Overview

Retry delays for server disconnects and authentication failures.

Defined in:

rosegold/reconnect_policy.cr

Constant Summary

AUTH_DELAYS = {5.minutes, 10.minutes, 15.minutes}
NORMAL_DELAYS = {10.seconds, 20.seconds, 40.seconds, 80.seconds, 160.seconds, 5.minutes}
TRANSPORT_DELAYS = {1.minute, 2.minutes, 4.minutes, 8.minutes, 15.minutes}

Instance Method Summary

Instance Method Detail

def next_delay(error : Minecraft::AuthenticationError | Nil = nil, connected_for : Time::Span | Nil = nil) : Time::Span #

Returns the next delay. Only time spent in a joined session resets backoff. A provider's Retry-After is a minimum, even when it exceeds the usual cap.


[View source]
def record_auth_success(phase : String) : Nil #

Clears the failure streak only for the authentication phase that succeeded.


[View source]