@@ -371,8 +371,8 @@ async def prefetch():
371
371
total_prefetched = await prefetch_endpoints ()
372
372
app_logger .info (f"Cache Pre Fetched { total_prefetched } endpoints" )
373
373
374
- # wait for one hour 30 minutes then prefetch urls again
375
- await asyncio .sleep (60 * 60 * 3 )
374
+ # wait for 3 hours minutes then prefetch urls again
375
+ await asyncio .sleep (60 * 60 * 3.5 )
376
376
377
377
async def backup_cf_firewall_data ():
378
378
while True :
@@ -404,12 +404,12 @@ async def monitor_servers():
404
404
asyncio .create_task (setup_cf_firewall ())
405
405
asyncio .create_task (backup_cf_firewall_data ())
406
406
asyncio .create_task (update_api_keys_background_task ())
407
- # asyncio.create_task(prefetch())
408
407
asyncio .create_task (process_credit_queue ())
409
408
asyncio .create_task (email_process .process_message_queues ())
410
409
asyncio .create_task (clean_up_memcache ())
411
410
asyncio .create_task (monitor_servers ())
412
411
asyncio .create_task (check_redis_errors ())
412
+ asyncio .create_task (prefetch ())
413
413
414
414
415
415
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -451,7 +451,7 @@ async def v1_gateway(request: Request, path: str):
451
451
# Will Take at least six second on the cache if it finds nothing will return None
452
452
# need an improved get timeout for the articles
453
453
tasks = [redis_cache .get (key = api_url , timeout = 60 * 5 ) for api_url in api_urls ]
454
- app_logger .info ("fetching responses" )
454
+ app_logger .info (f "fetching responses for { api_urls } " )
455
455
cached_responses = await asyncio .gather (* tasks )
456
456
app_logger .info ("fetched records" )
457
457
for i , response in enumerate (cached_responses ):
0 commit comments