Closed r4v5 closed 7 years ago
I think a reasonable path forward is to set a read timeout on the connection (c
) using net.Conn
's SetReadDeadline
. The value of this would be dependent on how often Twitch sends a PING
, which I don't remember (5 minutes is probably safe?)
In the event of a read timeout, the current behavior of crashing the program works just fine. The bot doesn't have any complicated state, so rebooting works fine.
Another suggestion from someone who's done a bunch of irc bot work (albeit in Python) is to do a client->server PING :timestamp with a writeDeadline, which should quickly reveal whether the bot is still connected. I'll try to grab this in the next few days if no one else jumps on it. The perils of too little free time.
Continuing a conversation from the chat: the TCP connection between kaet and twitch irc will sometimes die and kaet won't notice. We should detect this in a Go-ish way and either die (so that monit will pick it back up and start it) or reconnect it ourselves (if this can be done easily enough).