mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
cleanup
This commit is contained in:
@@ -45,7 +45,9 @@ def list_s3_objects():
|
|||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.error(f"An error occurred while regenerating cache {e}")
|
current_app.logger.error(
|
||||||
|
f"An error occurred while regenerating cache #notify-admin-1200 {e}"
|
||||||
|
)
|
||||||
return objects
|
return objects
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +65,9 @@ def get_s3_files():
|
|||||||
objects = list_s3_objects()
|
objects = list_s3_objects()
|
||||||
|
|
||||||
s3res = session.resource("s3", config=AWS_CLIENT_CONFIG)
|
s3res = session.resource("s3", config=AWS_CLIENT_CONFIG)
|
||||||
current_app.logger.info(f"JOBS cache length before regen: {len(JOBS)} #notify-admin-1200")
|
current_app.logger.info(
|
||||||
|
f"JOBS cache length before regen: {len(JOBS)} #notify-admin-1200"
|
||||||
|
)
|
||||||
for object in objects:
|
for object in objects:
|
||||||
object_arr = object.split("/")
|
object_arr = object.split("/")
|
||||||
job_id = object_arr[1]
|
job_id = object_arr[1]
|
||||||
@@ -74,7 +78,9 @@ def get_s3_files():
|
|||||||
)
|
)
|
||||||
if "phone number" in object.lower():
|
if "phone number" in object.lower():
|
||||||
JOBS[job_id] = object
|
JOBS[job_id] = object
|
||||||
current_app.logger.info(f"JOBS cache length after regen: {len(JOBS)} #notify-admin-1200")
|
current_app.logger.info(
|
||||||
|
f"JOBS cache length after regen: {len(JOBS)} #notify-admin-1200"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_s3_file(bucket_name, file_location, access_key, secret_key, region):
|
def get_s3_file(bucket_name, file_location, access_key, secret_key, region):
|
||||||
|
|||||||
@@ -443,7 +443,6 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id):
|
|||||||
|
|
||||||
@notify_celery.task(name="regenerate-job-cache")
|
@notify_celery.task(name="regenerate-job-cache")
|
||||||
def regenerate_job_cache():
|
def regenerate_job_cache():
|
||||||
print("ENTER REGENERATE_JOB_CACHE")
|
|
||||||
s3.get_s3_files()
|
s3.get_s3_files()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user