Fix connections

This commit is contained in:
ashatora
2024-05-01 09:59:22 +03:00
parent c6ccebd4fe
commit 9a23c4554b
2 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -77,11 +77,12 @@ def pika_callback(ch, method, properties, body):
files = []
for file in data['files']:
fn = os.path.join(gettempdir(), uuid4().hex)
download_file(file['name'], file['bucket'], fn)
files.append(fn)
download_file(file['url']['name'], file['url']['bucket'], fn)
file['url'] = fn
files.append(file)
run_task(params['query_type'], params, files, url)
# except JSONDecodeError as e:
# logging.warning(e)
except JSONDecodeError as e:
logging.warning(e)
finally:
ch.basic_ack(delivery_tag=method.delivery_tag)
@@ -92,7 +93,8 @@ def send_response(params, files, url):
for file in files:
fn = uuid4().hex
upload_file(file['url'], fn, Config.s3_bucket)
files_s3.append({'name': fn, 'bucket': Config.s3_bucket})
file['url'] = {'name': fn, 'bucket': Config.s3_bucket}
files_s3.append(file)
data = {
'params': params,
'files': files_s3,