mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
use greenlets for cache generation
This commit is contained in:
@@ -288,17 +288,18 @@ def get_s3_files():
|
|||||||
)
|
)
|
||||||
count = 0
|
count = 0
|
||||||
try:
|
try:
|
||||||
for object_key in object_keys:
|
greenlets = [
|
||||||
read_s3_file(bucket_name, object_key, s3res)
|
gevent.spawn(read_s3_file, bucket_name, object_key, s3res)
|
||||||
count = count + 1
|
for object_key in object_keys
|
||||||
gevent.sleep(0.2)
|
]
|
||||||
|
gevent.joinall(greenlets)
|
||||||
except Exception:
|
except Exception:
|
||||||
current_app.logger.exception(
|
current_app.logger.exception(
|
||||||
f"Trouble reading {object_key} which is # {count} during cache regeneration"
|
f"Trouble reading object_key which is # {count} during cache regeneration"
|
||||||
)
|
)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
current_app.logger.exception(
|
current_app.logger.exception(
|
||||||
f"Egress proxy issue reading {object_key} which is # {count}"
|
f"Egress proxy issue reading object_key which is # {count}"
|
||||||
)
|
)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user