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

Auto-delete queues when the last consumer using them unsubscribes #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions libmozevent/pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ async def create_pulse_listener(
# pulse but something we started doing in release services
queue = f"queue/{user}/exchange/{exchange_name}"

await channel.queue_declare(queue_name=queue, durable=True)
await channel.queue_declare(queue_name=queue, durable=True, auto_delete=True)

# in case we are going to listen to an exchange that is specific for this
# user, we need to ensure that exchange exists before first message is
# sent (this is what creates exchange)
if exchange.startswith(f"exchange/{user}/"):
await channel.exchange_declare(
exchange_name=exchange, type_name="topic", durable=True
exchange_name=exchange,
type_name="topic",
durable=True,
auto_delete=True,
)

for topic in topics:
Expand Down