testers
This commit is contained in:
@@ -3,6 +3,7 @@ from shutil import rmtree
|
||||
|
||||
import pika
|
||||
from django.core.management.base import BaseCommand
|
||||
from pika.adapters.utils.connection_workflow import AMQPConnectionWorkflowFailed
|
||||
|
||||
from Main.models import Solution
|
||||
from Sprint import settings
|
||||
@@ -14,6 +15,8 @@ class Command(BaseCommand):
|
||||
|
||||
def handle(self, *args, **options):
|
||||
print("Enter worker")
|
||||
while True:
|
||||
try:
|
||||
connection = pika.BlockingConnection(
|
||||
pika.ConnectionParameters(host=settings.RABBIT_HOST)
|
||||
)
|
||||
@@ -37,3 +40,5 @@ class Command(BaseCommand):
|
||||
|
||||
channel.basic_consume(queue="test", on_message_callback=callback, auto_ack=True)
|
||||
channel.start_consuming()
|
||||
except AMQPConnectionWorkflowFailed:
|
||||
print("connection to rabbit failed: reconnecting")
|
||||
|
Reference in New Issue
Block a user