This commit is contained in:
Kenneth Kehl
2024-01-18 10:16:14 -08:00
parent 2c6e632c78
commit 4b98106037

View File

@@ -101,8 +101,12 @@ def get_phone_number_from_s3(service_id, job_id, job_row_number):
# At the same time we don't want to store it in redis or the db # At the same time we don't want to store it in redis or the db
# So this is a little recycling mechanism to reduce the number of downloads. # So this is a little recycling mechanism to reduce the number of downloads.
job = JOBS.get(job_id) job = JOBS.get(job_id)
# TODO REMOVE
current_app.logger.info(f"HERE IS THE JOB FROM CACHE {job}")
if job is None: if job is None:
job = get_job_from_s3(service_id, job_id) job = get_job_from_s3(service_id, job_id)
# TODO REMOVE
current_app.logger.info(f"HERE IS THE JOB FROM S3 {job}")
JOBS[job_id] = job JOBS[job_id] = job
incr_jobs_cache_misses() incr_jobs_cache_misses()
else: else:
@@ -117,9 +121,17 @@ def get_phone_number_from_s3(service_id, job_id, job_row_number):
if item == "phone number": if item == "phone number":
break break
phone_index = phone_index + 1 phone_index = phone_index + 1
correct_row = job[job_row_number] correct_row = job[job_row_number]
correct_row = correct_row.split(",") correct_row = correct_row.split(",")
# TODO REMOVE
current_app.logger.info(
f"HERE IS THE CORRECT ROW AND PHONE INDEX {correct_row} {phone_index}"
)
# This could happen if an old job cannot be retrieved from s3
if len(correct_row) <= phone_index:
return "Unknown Phone"
my_phone = correct_row[phone_index] my_phone = correct_row[phone_index]
my_phone = re.sub(r"[\+\s\(\)\-\.]*", "", my_phone) my_phone = re.sub(r"[\+\s\(\)\-\.]*", "", my_phone)
return my_phone return my_phone