// reconnect attempts repeatedly to connect and subscribe to the named queue. It // will loop forever until it succeeds. This is used for a running server, where // we don't want to shut down because we lost our AMQP connection. func (ac *amqpConnector) reconnect(config *cmd.AMQPConfig, log blog.Logger) { for i := 0; ; i++ { ac.clk.Sleep(core.RetryBackoff(i, ac.retryTimeoutBase, ac.retryTimeoutMax, 2)) log.Info(fmt.Sprintf(" [!] attempting reconnect for %s", ac.queueName)) err := ac.connect(config) if err != nil { log.Warning(fmt.Sprintf(" [!] %s", err)) continue } break } log.Info(fmt.Sprintf(" [!] reconnect success for %s", ac.queueName)) return }