Skip to main content
Version: 1.0.x

Failsafe Mechanisms

Lunar.dev Failsafe Mechanisms help guarantee that your application remains operational, ensuring uninterrupted API traffic even when unexpected issues arise.

In the event that the Lunar Gateway fails to respond or the Interceptor cannot connect to the Gateway, the Failsafe Mechanism automatically reroutes traffic directly to the API provider. This minimizes potential delays and avoids the risk of downtime, keeping your system running smoothly under all conditions.

By default, the Failsafe Mechanism is enabled, providing a safety net that ensures any failure between the Interceptor or Gateway, doesn’t result in traffic loss or service disruption.

Additionally, the mechanism includes customizable settings like cooldown periods and retry attempts, allowing you to adjust the behavior to match your system's resilience needs.

This approach ensures that traffic continues flowing smoothly, even in the event of system issues, making it an essential feature for high-reliability environments where consistent uptime and performance are critical.

Gateway Failsafe Mechanism​

Lunar's Failsafe Mechanism is designed to ensure continuous traffic flow, even if something goes wrong with the Lunar Engine. In the unlikely event that the Lunar Engine crashes, all traffic will be automatically routed directly to the Provider, ensuring that your application's operation remains unaffected.

This approach guarantees uninterrupted traffic flow, minimizing any potential delays or disruptions.

NOTE

By default, the Failsafe Mechanism is enabled in the Lunar Engine.

To disable it, set the following environment variable:

LUNAR_ENGINE_FAILSAFE_ENABLED="false"

Interceptor Failsafe Mechanism​

Lunar designed a Failsafe Mechanism to avoid downtime or point of failure if something goes wrong between the interceptor and proxy in the rare case when the proxy is not available.

In case the pre-configured number of failed connection attempts to the Proxy was exceeded, a cooldown period will be initiated during which all the traffic will be directed to the original Provider.

If a connection still can not be restored after the cooldown period ended, then the Failsafe Mechanism will initiate another cooldown period after a single connectivity error.

By using this approach, the Failsafe Mechanism ensures that traffic flow is uninterrupted, and any possible delay is minimized. Additionally, the use of configurable cooldown and failed attempt parameters provides the flexibility to adjust the system according to specific needs.

NOTE

If not configured the Failsafe Mechanism will load with the following default values

LUNAR_ENTER_COOLDOWN_AFTER_ATTEMPTS="5"

LUNAR_EXIT_COOLDOWN_AFTER_SEC="10"