mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 18:22:17 -05:00
try to replace blocking sleep call with nonblocking sleep call
This commit is contained in:
@@ -6,6 +6,7 @@ from concurrent.futures import ThreadPoolExecutor
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
import botocore
|
import botocore
|
||||||
|
import eventlet
|
||||||
from boto3 import Session
|
from boto3 import Session
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
@@ -375,7 +376,7 @@ def get_job_from_s3(service_id, job_id):
|
|||||||
)
|
)
|
||||||
retries += 1
|
retries += 1
|
||||||
sleep_time = backoff_factor * (2**retries) # Exponential backoff
|
sleep_time = backoff_factor * (2**retries) # Exponential backoff
|
||||||
time.sleep(sleep_time)
|
eventlet.sleep(sleep_time)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
# Typically this is "NoSuchKey"
|
# Typically this is "NoSuchKey"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
|
import eventlet
|
||||||
from celery.signals import task_postrun
|
from celery.signals import task_postrun
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from requests import HTTPError, RequestException, request
|
from requests import HTTPError, RequestException, request
|
||||||
@@ -83,7 +83,7 @@ def process_job(job_id, sender_id=None):
|
|||||||
process_row(row, template, job, service, sender_id=sender_id)
|
process_row(row, template, job, service, sender_id=sender_id)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
if count % 3 == 0:
|
if count % 3 == 0:
|
||||||
sleep(1)
|
eventlet.sleep(1)
|
||||||
|
|
||||||
# End point/Exit point for message send flow.
|
# End point/Exit point for message send flow.
|
||||||
job_complete(job, start=start)
|
job_complete(job, start=start)
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class AwsCloudwatchClient(Client):
|
|||||||
# result = temp_client.get_query_results(queryId=query_id)
|
# result = temp_client.get_query_results(queryId=query_id)
|
||||||
# if result['status'] == 'Complete':
|
# if result['status'] == 'Complete':
|
||||||
# break
|
# break
|
||||||
# time.sleep(1)
|
# eventlet.sleep(1)
|
||||||
|
|
||||||
# delivery_receipts = []
|
# delivery_receipts = []
|
||||||
# for log in result['results']:
|
# for log in result['results']:
|
||||||
|
|||||||
Reference in New Issue
Block a user