quality / commitlint (push) Skipped
CD / update-wiki (push) Failing after 8s
quality / changes (push) Successful in 5s
quality / docker-check (push) Skipped
quality / web (push) Successful in 50s
quality / api (push) Successful in 41s
CD / quality (push) Successful in 1m40s
CD / publish (push) Successful in 1m33s
- Introduced origin health check routes and integrated them into the application. - Updated health check configuration to include success recovery thresholds. - Expanded error handling with new error codes for health check failures. - Added new service routes for managing health checks, including creation and listing. - Improved health check service logic to track consecutive successes and failures. This commit enhances the health check capabilities, providing better monitoring and management of service health.
27 lines
851 B
TypeScript
27 lines
851 B
TypeScript
import type { LbMode } from "@cfdm/shared";
|
|
import { failoverDesired } from "./failover.js";
|
|
import { roundRobinDesired } from "./round-robin.js";
|
|
import type { LbIpRow, LbTargetConfig } from "./types.js";
|
|
|
|
export type { LbIpRow, LbTargetConfig } from "./types.js";
|
|
export { isHealthy } from "./health.js";
|
|
export { withBindingLock } from "./binding-lock.js";
|
|
|
|
export function selectActiveIpsByMode(
|
|
config: LbTargetConfig,
|
|
rows: LbIpRow[],
|
|
): string[] {
|
|
if (rows.length === 0) return [];
|
|
if (config.lb_mode === "failover") {
|
|
return failoverDesired(rows);
|
|
}
|
|
// weighted = round_robin on DNS (one A per IP)
|
|
return roundRobinDesired(rows);
|
|
}
|
|
|
|
export function strategyLabel(mode: LbMode): string {
|
|
if (mode === "failover") return "Failover";
|
|
if (mode === "weighted") return "Round Robin (weighted alias)";
|
|
return "Round Robin";
|
|
}
|