Spaces:
Sleeping
Sleeping
Update api/endpoints/location.py
Browse files
api/endpoints/location.py
CHANGED
|
@@ -29,10 +29,10 @@ async def get_coordinates_v1(cord):
|
|
| 29 |
|
| 30 |
async def process_coordinates(supabase_user_data, max_concurrency=15):
|
| 31 |
coords=[]
|
| 32 |
-
with
|
| 33 |
-
futures =
|
| 34 |
for future in concurrent.futures.as_completed(futures):
|
| 35 |
-
|
| 36 |
try:
|
| 37 |
result = future.result()
|
| 38 |
coords.append(result)
|
|
|
|
| 29 |
|
| 30 |
async def process_coordinates(supabase_user_data, max_concurrency=15):
|
| 31 |
coords=[]
|
| 32 |
+
with ThreadPoolExecutor(max_workers=15) as executor::
|
| 33 |
+
futures = [executor.submit(LocationService.get_coordinates,cord) for cord in supabase_user_data]
|
| 34 |
for future in concurrent.futures.as_completed(futures):
|
| 35 |
+
|
| 36 |
try:
|
| 37 |
result = future.result()
|
| 38 |
coords.append(result)
|