4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 13:09:24 +00:00

Do not panic on non-json response from server (zulip)

This commit is contained in:
Wim
2019-02-13 00:29:34 +01:00
parent f236d12166
commit 5af1d80055
5 changed files with 17 additions and 5 deletions

View File

@ -104,6 +104,9 @@ func (b *Bzulip) handleQueue() error {
switch err {
case gzb.BackoffError:
time.Sleep(time.Second * 5)
case gzb.NoJSONError:
b.Log.Error("Response wasn't JSON, server down or restarting? sleeping 10 seconds")
time.Sleep(time.Second * 10)
case gzb.BadEventQueueError:
b.Log.Info("got a bad event queue id error, reconnecting")
b.bot.Queues = nil
@ -113,10 +116,14 @@ func (b *Bzulip) handleQueue() error {
time.Sleep(time.Second * 10)
continue
}
continue
case gzb.HeartbeatError:
b.Log.Debug("heartbeat received.")
default:
b.Log.Debugf("receiving error: %#v", err)
}
if err != nil {
continue
}
for _, m := range messages {
b.Log.Debugf("== Receiving %#v", m)
// ignore our own messages