diff options
author | Wim <wim@42.be> | 2019-02-13 00:29:34 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2019-02-13 00:29:34 +0100 |
commit | 5af1d8005509e42102b2e2c2319b1fd754bb46f3 (patch) | |
tree | 5d2673ca96f3232fbdf9f0cefc913dbbde293220 /bridge/zulip/zulip.go | |
parent | f236d12166a8ae186b251fee15b88d774dabc69c (diff) | |
download | matterbridge-msglm-5af1d8005509e42102b2e2c2319b1fd754bb46f3.tar.gz matterbridge-msglm-5af1d8005509e42102b2e2c2319b1fd754bb46f3.tar.bz2 matterbridge-msglm-5af1d8005509e42102b2e2c2319b1fd754bb46f3.zip |
Do not panic on non-json response from server (zulip)
Diffstat (limited to 'bridge/zulip/zulip.go')
-rw-r--r-- | bridge/zulip/zulip.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bridge/zulip/zulip.go b/bridge/zulip/zulip.go index 165bdb18..3c6c7ec6 100644 --- a/bridge/zulip/zulip.go +++ b/bridge/zulip/zulip.go @@ -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 |