def discard_all(connection=None, connect_timeout=conf.BROKER_CONNECTION_TIMEOUT): """Discard all waiting tasks. This will ignore all tasks waiting for execution, and they will be deleted from the messaging server. :returns: the number of tasks discarded. """ consumer = TaskConsumer(connection=connection) try: return consumer.discard_all() finally: consumer.close()
def discard_all(): """Discard all waiting tasks. This will ignore all tasks waiting for execution, and they will be deleted from the messaging server. :returns: the number of tasks discarded. :rtype: int """ amqp_connection = DjangoAMQPConnection() consumer = TaskConsumer(connection=amqp_connection) discarded_count = consumer.discard_all() amqp_connection.close() return discarded_count
def _discard(connection): consumer = TaskConsumer(connection=connection) try: return consumer.discard_all() finally: consumer.close()