From 83601f2dd0f5a9883808a64f14c8a1b0072a622e Mon Sep 17 00:00:00 2001 From: jay Date: Fri, 21 Sep 2018 23:33:52 +0800 Subject: [PATCH] v1 (? --- module/twitch-irc/twitch-irc.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/module/twitch-irc/twitch-irc.go b/module/twitch-irc/twitch-irc.go index 181a8df..0a9e502 100644 --- a/module/twitch-irc/twitch-irc.go +++ b/module/twitch-irc/twitch-irc.go @@ -43,6 +43,12 @@ func InitIRC() { err = client.Run() if err != nil { fmt.Println("twitch chat connect fail") + // reconnect after 3sec + time.Sleep(time.Second * 3) + client = nil + channels = channels[:0] + queue.Clear() + go InitIRC() } } @@ -156,7 +162,7 @@ func runQueue() { client.WriteMessage(msg) } cnt++ - if cnt > 1800 { + if cnt > 3600 { // call rejoin ReJoin() cnt = 0