Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

826 B
Raw Blame
/**
 * Retry only when nothing can have reached the target. A half-applied change replayed on a second
 * member would apply twice.
 */

/** `transportError` is never cleared, so requiring that no channel established is what bounds it. */
export const isGatewayTransportFailure = ({
  transportError,
  establishedChannel
}: {
  transportError: string;
  establishedChannel: boolean;
}): boolean => Boolean(transportError) && !establishedChannel;

/** An early tunnel can fail while a later one reaches the target, so a transport failure alone is not enough. */
export const isAttemptRetryable = ({
  transportFailed,
  tunnelEstablished,
  isTransportError
}: {
  transportFailed: boolean;
  tunnelEstablished: boolean;
  isTransportError: boolean;
}): boolean => (transportFailed || isTransportError) && !tunnelEstablished;