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

Conversation

matusvalo
Copy link
Member

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'
)

Fixes #1063

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix look good to me but the non pypy integration test failed for some reason.

@matusvalo
Copy link
Member Author

the fix look good to me but the non pypy integration test failed for some reason.

The pypy integration test is failing a long time. Not sure why.

@auvipy
Copy link
Member

auvipy commented Oct 23, 2021

yeah but im talking about other integrations tests. the tools that run CI needs some minor tweaks. like pypy should be pypy-3.7 etc. I have to check docs and try to fix them this week

@matusvalo
Copy link
Member Author

yeah but im talking about other integrations tests.

The other int. tests were canceled since the one failed. The failing one ideally should be fixed but I dont have time for that right now.

@auvipy
Copy link
Member

auvipy commented Oct 23, 2021

yeah the CI can use pypy more then 3.6 thats the issue

…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'
)
@auvipy auvipy merged commit 73b10a9 into celery:master Oct 25, 2021
@matusvalo matusvalo deleted the fix_get_table branch October 25, 2021 05:35
@matusvalo matusvalo mentioned this pull request Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Table empty or key no longer exists
2 participants