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

Fix error handling on bad event queue id (zulip). Closes #694

This commit is contained in:
Wim
2019-02-11 01:34:50 +01:00
parent 8147815037
commit 40d76b2296
5 changed files with 63 additions and 15 deletions

View File

@ -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