Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pup/lib/core/loadbalancer.ts>LoadBalancer

Universal process manager built in Deno
Go to Latest
class LoadBalancer
import { LoadBalancer } from "https://deno.land/x/pup@1.0.0-rc.9/lib/core/loadbalancer.ts";

Constructors

new
LoadBalancer(
backends: Backend[],
strategy?: BalancingStrategy,
validationInterval?: number,
loggerCallback: (
severity: string,
category: string,
text: string,
) => void
,
)

Properties

private
currentIndex: number
private
listener: Deno.Listener | null
private
loggerCallback: (
severity: string,
category: string,
text: string,
) => void
private
strategy: BalancingStrategy
private
validationInterval: number
private
validationTimer: number
backends: InternalBackend[]

Methods

private
handleProxyCommunication(
client: Deno.Conn,
targetConn: Deno.Conn,
backend: InternalBackend,
): Promise<void>
private
markBackendAsDown(backend: InternalBackend): void
private
proxy(client: Deno.Conn, backend: InternalBackend): Promise<void>
private
setupValidationTimer(): number
private
validateBackends(): Promise<void>
close(): void
start(port: number): Promise<void>
updateBackendConnectionStatus(backend: InternalBackend, isConnected: boolean): void