From 5288f6ba1b79b0d548fc52df61612a1e9ad65b93 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 30 Apr 2024 08:18:44 +0000 Subject: [PATCH] double calls removal --- kitchen_counter/conversion/apps.py | 32 +----------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/kitchen_counter/conversion/apps.py b/kitchen_counter/conversion/apps.py index ce25a85..695a777 100755 --- a/kitchen_counter/conversion/apps.py +++ b/kitchen_counter/conversion/apps.py @@ -1,34 +1,4 @@ from django.apps import AppConfig -import boto3 -from django.db.models.signals import post_migrate - -session = boto3.Session( - aws_access_key_id='AKIAQVLBBGCB45RMLKVW', # replace with your key - aws_secret_access_key='ZWc6KOc5LuBLuCEBDDfQTor+Q7rp3fFH74gVt+AA', # replace with your key -) -sqs = session.resource('sqs', region_name='ap-south-1') - class ConversionConfig(AppConfig): - name = 'conversion' - - - def ready(self): - post_migrate.connect(self.on_post_migrate, sender=self) - - def on_post_migrate(self, **kwargs): - from mnfapp.models import ScriptTranslations - logger.info("Started Executin this from conversion") - queue = sqs.get_queue_by_name(QueueName="mnfqueue") - try: - messages = queue.receive_messages( - MessageAttributeNames=["All"], - MaxNumberOfMessages=5, - WaitTimeSeconds=30, - ) - for msg in messages: - logger.info("Received message: %s: %s", msg.message_id, msg.body) - - except ClientError as error: - logger.exception("Couldn't receive messages from queue: %s", queue) - raise error \ No newline at end of file + name = 'conversion' \ No newline at end of file