diff --git a/consumer.go b/consumer.go index 9bd8d1820..61c9bc57a 100644 --- a/consumer.go +++ b/consumer.go @@ -839,10 +839,12 @@ func (bc *brokerConsumer) handleResponses() { child.responseResult = nil if result == nil { - if child.preferredReadReplica >= 0 && bc.broker.ID() != child.preferredReadReplica { - // not an error but needs redispatching to consume from prefered replica - child.trigger <- none{} - delete(bc.subscriptions, child) + if preferredBroker, err := child.preferredBroker(); err == nil { + if bc.broker.ID() != preferredBroker.ID() { + // not an error but needs redispatching to consume from prefered replica + child.trigger <- none{} + delete(bc.subscriptions, child) + } } continue }