Add a ping monitor, to prevent/recover from servers silently disconnecting
This commit is contained in:
parent
9402a536f7
commit
e5a1ac6897
2 changed files with 7 additions and 1 deletions
|
@ -52,6 +52,7 @@ servers: dict[str, dict[str, Any]] = {
|
||||||
"address": "irc.underworld.no",
|
"address": "irc.underworld.no",
|
||||||
"channels": {"#random": 0, "#dice": 0},
|
"channels": {"#random": 0, "#dice": 0},
|
||||||
"hosts": ["154.sub-174-251-241.myvzw.com"],
|
"hosts": ["154.sub-174-251-241.myvzw.com"],
|
||||||
|
"threads": ["pingMon"],
|
||||||
"dnsblMode": "kickban",
|
"dnsblMode": "kickban",
|
||||||
},
|
},
|
||||||
"replirc": {
|
"replirc": {
|
||||||
|
|
|
@ -148,7 +148,12 @@ def radio(instance: bare.bot) -> NoReturn:
|
||||||
instance.log("Thread while loop broken", "FATAL")
|
instance.log("Thread while loop broken", "FATAL")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
def ping(instance: bare.bot) -> NoReturn:
|
||||||
|
while 1:
|
||||||
|
instance.sendraw("PING :keepalive")
|
||||||
|
sleep(30)
|
||||||
|
|
||||||
data: dict[str, dict[str, Any]] = {
|
data: dict[str, dict[str, Any]] = {
|
||||||
"radio": {"noWrap": True, "func": radio, "passInstance": True}
|
"radio": {"noWrap": True, "func": radio, "passInstance": True},
|
||||||
|
"pingMon": {"noWrap": True, "func": ping, "passInstance": True}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue