mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-25 04:02:03 -08:00
Backoff for 60 seconds when reconnecting too fast
This commit is contained in:
parent
7aabe12acf
commit
a61e2db7cb
6
vendor/github.com/42wim/go-ircevent/irc.go
generated
vendored
6
vendor/github.com/42wim/go-ircevent/irc.go
generated
vendored
@ -227,12 +227,17 @@ func (irc *Connection) isQuitting() bool {
|
|||||||
// Main loop to control the connection.
|
// Main loop to control the connection.
|
||||||
func (irc *Connection) Loop() {
|
func (irc *Connection) Loop() {
|
||||||
errChan := irc.ErrorChan()
|
errChan := irc.ErrorChan()
|
||||||
|
connTime := time.Now()
|
||||||
for !irc.isQuitting() {
|
for !irc.isQuitting() {
|
||||||
err := <-errChan
|
err := <-errChan
|
||||||
close(irc.end)
|
close(irc.end)
|
||||||
irc.Wait()
|
irc.Wait()
|
||||||
for !irc.isQuitting() {
|
for !irc.isQuitting() {
|
||||||
irc.Log.Printf("Error, disconnected: %s\n", err)
|
irc.Log.Printf("Error, disconnected: %s\n", err)
|
||||||
|
if time.Now().Sub(connTime) < time.Second*5 {
|
||||||
|
irc.Log.Println("Rreconnecting too fast, sleeping 60 seconds")
|
||||||
|
time.Sleep(60 * time.Second)
|
||||||
|
}
|
||||||
if err = irc.Reconnect(); err != nil {
|
if err = irc.Reconnect(); err != nil {
|
||||||
irc.Log.Printf("Error while reconnecting: %s\n", err)
|
irc.Log.Printf("Error while reconnecting: %s\n", err)
|
||||||
time.Sleep(60 * time.Second)
|
time.Sleep(60 * time.Second)
|
||||||
@ -241,6 +246,7 @@ func (irc *Connection) Loop() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
connTime = time.Now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user