mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
clean up
This commit is contained in:
@@ -36,7 +36,6 @@ def clean_cache():
|
|||||||
keys_to_delete.append(key)
|
keys_to_delete.append(key)
|
||||||
|
|
||||||
for key in keys_to_delete:
|
for key in keys_to_delete:
|
||||||
print(hilite(f"DELETING {key}"))
|
|
||||||
del job_cache[key]
|
del job_cache[key]
|
||||||
|
|
||||||
|
|
||||||
@@ -349,13 +348,10 @@ def extract_personalisation(job):
|
|||||||
|
|
||||||
|
|
||||||
def get_phone_number_from_s3(service_id, job_id, job_row_number):
|
def get_phone_number_from_s3(service_id, job_id, job_row_number):
|
||||||
print("ENTER get_phone_number_from_s3")
|
|
||||||
job = job_cache.get(job_id)
|
job = job_cache.get(job_id)
|
||||||
print(f"JOB FROM CACHE {job}")
|
|
||||||
if job is None:
|
if job is None:
|
||||||
current_app.logger.info(f"job {job_id} was not in the cache")
|
current_app.logger.info(f"job {job_id} was not in the cache")
|
||||||
job = get_job_from_s3(service_id, job_id)
|
job = get_job_from_s3(service_id, job_id)
|
||||||
print(f"JOB from s3 {job}")
|
|
||||||
# Even if it is None, put it here to avoid KeyErrors
|
# Even if it is None, put it here to avoid KeyErrors
|
||||||
set_job_cache(job_cache, job_id, job)
|
set_job_cache(job_cache, job_id, job)
|
||||||
else:
|
else:
|
||||||
@@ -372,11 +368,9 @@ def get_phone_number_from_s3(service_id, job_id, job_row_number):
|
|||||||
# and that dictionary is not there, create it
|
# and that dictionary is not there, create it
|
||||||
if job_cache.get(f"{job_id}_phones") is None:
|
if job_cache.get(f"{job_id}_phones") is None:
|
||||||
phones = extract_phones(job)
|
phones = extract_phones(job)
|
||||||
print(f"HMMM job is {job} phones are {phones}")
|
|
||||||
set_job_cache(job_cache, f"{job_id}_phones", phones)
|
set_job_cache(job_cache, f"{job_id}_phones", phones)
|
||||||
|
|
||||||
# If we can find the quick dictionary, use it
|
# If we can find the quick dictionary, use it
|
||||||
print(f"PHONES {phones} ROW NUMBER {job_row_number}")
|
|
||||||
phone_to_return = phones[job_row_number]
|
phone_to_return = phones[job_row_number]
|
||||||
if phone_to_return:
|
if phone_to_return:
|
||||||
return phone_to_return
|
return phone_to_return
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ class Config(object):
|
|||||||
},
|
},
|
||||||
"clean-job-cache": {
|
"clean-job-cache": {
|
||||||
"task": "clean-job-cache",
|
"task": "clean-job-cache",
|
||||||
"schedule": crontab(minute="*/5"),
|
"schedule": crontab(hour=2, minute=11),
|
||||||
"options": {"queue": QueueNames.PERIODIC},
|
"options": {"queue": QueueNames.PERIODIC},
|
||||||
},
|
},
|
||||||
"cleanup-unfinished-jobs": {
|
"cleanup-unfinished-jobs": {
|
||||||
|
|||||||
Reference in New Issue
Block a user