From 740b5f260243bd95ed83c6cfc805543e5d87b5e8 Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 26 Feb 2019 17:08:20 +0100 Subject: [PATCH] Keep reconnecting until succeed (zulip) (#737) --- bridge/zulip/zulip.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bridge/zulip/zulip.go b/bridge/zulip/zulip.go index 89c3b059..77bb7e7e 100644 --- a/bridge/zulip/zulip.go +++ b/bridge/zulip/zulip.go @@ -116,11 +116,13 @@ func (b *Bzulip) handleQueue() error { 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 + for { + b.q, err = b.bot.RegisterAll() + if err != nil { + b.Log.Errorf("reconnecting failed: %s. Sleeping 10 seconds", err) + time.Sleep(time.Second * 10) + } + break } case gzb.HeartbeatError: b.Log.Debug("heartbeat received.")