���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
.trash
/
node_modules
/
ioredis
/
built
/
connectors
/
SentinelConnector
/
Viewing: FailoverDetector.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FailoverDetector = void 0; const utils_1 = require("../../utils"); const debug = (0, utils_1.Debug)("FailoverDetector"); const CHANNEL_NAME = "+switch-master"; class FailoverDetector { // sentinels can't be used for regular commands after this constructor(connector, sentinels) { this.isDisconnected = false; this.connector = connector; this.sentinels = sentinels; } cleanup() { this.isDisconnected = true; for (const sentinel of this.sentinels) { sentinel.client.disconnect(); } } async subscribe() { debug("Starting FailoverDetector"); const promises = []; for (const sentinel of this.sentinels) { const promise = sentinel.client.subscribe(CHANNEL_NAME).catch((err) => { debug("Failed to subscribe to failover messages on sentinel %s:%s (%s)", sentinel.address.host || "127.0.0.1", sentinel.address.port || 26739, err.message); }); promises.push(promise); sentinel.client.on("message", (channel) => { if (!this.isDisconnected && channel === CHANNEL_NAME) { this.disconnect(); } }); } await Promise.all(promises); } disconnect() { // Avoid disconnecting more than once per failover. // A new FailoverDetector will be created after reconnecting. this.isDisconnected = true; debug("Failover detected, disconnecting"); // Will call this.cleanup() this.connector.disconnect(); } } exports.FailoverDetector = FailoverDetector;
Coded With 💗 by
0x6ick Mod By V1rus_Alfa