Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

545 B
Raw Blame
import type { ServiceStatus } from "./service-status";

type RealtimeStatusInput = {
  adapter: "redis" | "in-memory" | null;
  redisStatus: ServiceStatus;
};

/**
 * Sockets on this instance keep working while Redis is down; only delivery
 * to clients on other instances stops. Without an adapter nothing is sent.
 */
export function realtimeStatus({
  adapter,
  redisStatus,
}: RealtimeStatusInput): ServiceStatus {
  if (adapter === null) return "down";
  if (adapter === "redis" && redisStatus !== "ok") return "warning";
  return "ok";
}