Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return empty list instead of InconsistencyError when exchange table is empty #1404

Merged
merged 1 commit into from
Oct 25, 2021

Commits on Oct 24, 2021

  1. Return empty list instead of InconsistencyError when exchange table i…

    …s empty
    
    Missing redis key containg set of queues bound to queue is caused
    by removal all queues from the exchange. Hence, we should not raise an
    exception but just return empty list of queues instead. This commit
    fixes e.g. case publishing message against empty exchange:
    
    import kombu
    conn = kombu.Connection('redis://')
    exchange = kombu.Exchange('name', type='direct')
    exchange.declare(channel=conn.default_channel)
    
    producer = conn.Producer()
    producer.publish(
         {'hello': 'world'},
         exchange=exchange,
         routing_key='queue1'
    )
    
    But it also fixes the case when last queue is unbound from exchange and
    after publishing to this exchange:
    
    import kombu
    conn = kombu.Connection('redis://')
    exchange = kombu.Exchange('name', type='direct')
    queue1 = kombu.Queue('queue1', exchange=exchange, routing_key='queue1')
    exchange.declare(channel=conn.default_channel)
    queue1 = queue1.bind(channel=conn.default_channel)
    queue1.declare()
    
    producer = conn.Producer()
    producer.publish(
         {'hello': 'world'},
         exchange=exchange,
         routing_key='queue1'
    )
    
    queue1.delete()
    
    producer.publish(
         {'hello': 'world'},
         exchange=exchange,
         routing_key='queue1'
    )
    matusvalo committed Oct 24, 2021
    Configuration menu
    Copy the full SHA
    c1bb06f View commit details
    Browse the repository at this point in the history