зеркало из https://github.com/mozilla/treeherder.git
Bug 1607561 - Pulse ingestion: Auto delete queues if no consumers are left (#6117)
This does not apply to production Heroku apps.
This commit is contained in:
Родитель
313f73df14
Коммит
2d02d95588
1
app.json
1
app.json
|
@ -41,6 +41,7 @@
|
|||
"PULSE_TASKS_QUEUE_NAME": {
|
||||
"generator": "secret"
|
||||
},
|
||||
"PULSE_AUTO_DELETE_QUEUES": true,
|
||||
"PROJECTS_TO_INGEST": {
|
||||
"value": "autoland,try"
|
||||
},
|
||||
|
|
|
@ -19,6 +19,7 @@ services:
|
|||
- UPSTREAM_DATABASE_URL=${UPSTREAM_DATABASE_URL:-}
|
||||
- PERF_SHERIFF_BOT_CLIENT_ID=${PERF_SHERIFF_BOT_CLIENT_ID:-}
|
||||
- PERF_SHERIFF_BOT_ACCESS_TOKEN=${PERF_SHERIFF_BOT_ACCESS_TOKEN:-}
|
||||
- PULSE_AUTO_DELETE_QUEUES=True
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- SITE_URL=http://backend:8000/
|
||||
- TREEHERDER_DEBUG=True
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import platform
|
||||
import re
|
||||
from datetime import timedelta
|
||||
|
@ -34,6 +35,13 @@ GRAPHQL = env.bool("GRAPHQL", default=True)
|
|||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = env("TREEHERDER_DJANGO_SECRET_KEY", default='secret-key-of-at-least-50-characters-to-pass-check-deploy')
|
||||
|
||||
# Delete the Pulse automatically when no consumers left
|
||||
PULSE_AUTO_DELETE_QUEUES = env.bool("PULSE_AUTO_DELETE_QUEUES", default=False)
|
||||
|
||||
# Changing PULSE_AUTO_DELETE_QUEUES to true when treeherder is running in virtual environment
|
||||
if hasattr(os.environ, 'VIRTUAL_ENV'):
|
||||
PULSE_AUTO_DELETE_QUEUES = True
|
||||
|
||||
# Hosts
|
||||
SITE_URL = env("SITE_URL", default='http://localhost:8000')
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import threading
|
|||
|
||||
import environ
|
||||
import newrelic.agent
|
||||
from django.conf import settings
|
||||
from kombu import (Connection,
|
||||
Exchange,
|
||||
Queue)
|
||||
|
@ -92,7 +93,7 @@ class PulseConsumer(ConsumerMixin):
|
|||
exchange=exchange,
|
||||
routing_key=routing_key,
|
||||
durable=True,
|
||||
auto_delete=False,
|
||||
auto_delete=settings.PULSE_AUTO_DELETE_QUEUES,
|
||||
)
|
||||
self.consumers.append(dict(queues=self.queue,
|
||||
callbacks=[self.on_message]))
|
||||
|
|
Загрузка…
Ссылка в новой задаче