mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-16 13:56:03 +08:00
rabbitmq_cluster: limit queue size to 1GB and remove stale queues
When a user creates a queue and then never consumes from it (such at the current Greenwave queue) it grows and grows forever. This isn't a problem in the short term as messages are very small and 100K messages is in the range of 10MB (depending on the payload size, obviously), but eventually it will lead to trouble. This policy will delete any queue that has had no subscribers in 31 days, and as a safety measure also limits all queues to 1GB of storage, which is probably excessive. Signed-off-by: Jeremy Cline <jeremy@jcline.org>
This commit is contained in:
@@ -180,6 +180,24 @@
|
||||
- rabbitmq_cluster
|
||||
- config
|
||||
|
||||
- name: Add a policy to limit queues to 1GB and remove after a month of no use
|
||||
run_once: true
|
||||
delegate_to: "rabbitmq01{{ env_suffix }}.phx2.fedoraproject.org"
|
||||
rabbitmq_policy:
|
||||
apply_to: queues
|
||||
name: pubsub_sweeper
|
||||
state: present
|
||||
pattern: ".*"
|
||||
tags:
|
||||
# Unused queues are killed after 1000 * 60 * 60 * 31 milliseconds (~a month)
|
||||
expires: 111600000
|
||||
# Queues can use at most 1GB of storage
|
||||
max-length-bytes: 1073741824
|
||||
vhost: /pubsub
|
||||
tags:
|
||||
- rabbitmq_cluster
|
||||
- config
|
||||
|
||||
- name: Create the admin user for the pubsub vhost
|
||||
rabbitmq_user:
|
||||
user: admin
|
||||
|
||||
Reference in New Issue
Block a user