2013-09-11 19:58:58 +02:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
from django.core.management import CommandError
|
|
|
|
from zerver.lib.queue import SimpleQueueClient
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
2015-08-21 02:10:41 +02:00
|
|
|
def add_arguments(self, parser):
|
|
|
|
parser.add_argument('queue_name', metavar='<queue name>', type=str,
|
|
|
|
help="queue to purge")
|
|
|
|
|
2013-09-11 19:58:58 +02:00
|
|
|
help = "Discards all messages from the given queue"
|
|
|
|
def handle(self, *args, **options):
|
2015-08-21 02:10:41 +02:00
|
|
|
queue_name = options['queue_name']
|
2013-09-11 19:58:58 +02:00
|
|
|
queue = SimpleQueueClient()
|
2013-10-23 18:02:42 +02:00
|
|
|
queue.ensure_queue(queue_name, lambda: None)
|
|
|
|
queue.channel.queue_purge(queue_name)
|
|
|
|
print "Done"
|