mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: IRCBot re-connection back-off (#4322)
This commit is contained in:
@ -372,7 +372,7 @@ class IRCBot
|
|||||||
return die();
|
return die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->log('Trying to connect to '.$this->server.':'.$this->port.($this->ssl ? ' (SSL)' : ''));
|
$this->log('Trying to connect ('.($try + 1).') to '.$this->server.':'.$this->port.($this->ssl ? ' (SSL)' : ''));
|
||||||
if ($this->socket['irc']) {
|
if ($this->socket['irc']) {
|
||||||
fclose($this->socket['irc']);
|
fclose($this->socket['irc']);
|
||||||
}
|
}
|
||||||
@ -392,6 +392,13 @@ class IRCBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_resource($this->socket['irc'])) {
|
if (!is_resource($this->socket['irc'])) {
|
||||||
|
if ($try < 5) {
|
||||||
|
sleep(5);
|
||||||
|
} elseif ($try < 10) {
|
||||||
|
sleep(60);
|
||||||
|
} else {
|
||||||
|
sleep(300);
|
||||||
|
}
|
||||||
return $this->connect($try + 1);
|
return $this->connect($try + 1);
|
||||||
} else {
|
} else {
|
||||||
stream_set_blocking($this->socket['irc'], false);
|
stream_set_blocking($this->socket['irc'], false);
|
||||||
|
Reference in New Issue
Block a user