diff options
author | Wim <wim@42.be> | 2019-02-11 01:34:50 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2019-02-11 01:34:50 +0100 |
commit | 40d76b22960fcc57e167fb08b97f4ff3aec31090 (patch) | |
tree | 832a9b0cb7aa02df10083e18be91a98434e227a5 /bridge | |
parent | 81478150373979a3061d94948ad2f2842ee87243 (diff) | |
download | matterbridge-msglm-40d76b22960fcc57e167fb08b97f4ff3aec31090.tar.gz matterbridge-msglm-40d76b22960fcc57e167fb08b97f4ff3aec31090.tar.bz2 matterbridge-msglm-40d76b22960fcc57e167fb08b97f4ff3aec31090.zip |
Fix error handling on bad event queue id (zulip). Closes #694
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/zulip/zulip.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/bridge/zulip/zulip.go b/bridge/zulip/zulip.go index 88832d36..165bdb18 100644 --- a/bridge/zulip/zulip.go +++ b/bridge/zulip/zulip.go @@ -100,7 +100,23 @@ func (b *Bzulip) getChannel(id int) string { func (b *Bzulip) handleQueue() error { for { - messages, _ := b.q.GetEvents() + messages, err := b.q.GetEvents() + switch err { + case gzb.BackoffError: + time.Sleep(time.Second * 5) + case gzb.BadEventQueueError: + b.Log.Info("got a bad event queue id error, reconnecting") + b.bot.Queues = nil + b.q, err = b.bot.RegisterAll() + if err != nil { + b.Log.Errorf("reconnecting failed: %s. Sleeping 10 seconds", err) + time.Sleep(time.Second * 10) + continue + } + continue + default: + b.Log.Debugf("receiving error: %#v", err) + } for _, m := range messages { b.Log.Debugf("== Receiving %#v", m) // ignore our own messages |