This commit is contained in:
Jay 2018-09-21 23:33:52 +08:00
parent 8504a8c708
commit 83601f2dd0

View File

@ -43,6 +43,12 @@ func InitIRC() {
err = client.Run() err = client.Run()
if err != nil { if err != nil {
fmt.Println("twitch chat connect fail") 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) client.WriteMessage(msg)
} }
cnt++ cnt++
if cnt > 1800 { if cnt > 3600 {
// call rejoin // call rejoin
ReJoin() ReJoin()
cnt = 0 cnt = 0