77
88dotenv .load_dotenv ()
99sesame_api_baseurl = os .getenv ('SESAME_API_BASEURL' )
10- sem = asyncio .Semaphore (50 )
1110
1211configs = {
1312 "taiga_etd.json" : {
@@ -134,7 +133,7 @@ async def process_data(data, config, file, session):
134133 with open (f'./data/{ file } ' , 'w' , encoding = 'utf-8' ) as fichier :
135134 json .dump (result , fichier , ensure_ascii = False )
136135 tasks = [send_request (session , f'{ sesame_api_baseurl } /management/identities/upsert' , entry ) for entry in result ]
137- await gather_with_concurrency (10 , tasks )
136+ await gather_with_concurrency (25 , tasks )
138137 print (f"Processed { file } " )
139138
140139async def import_ind ():
@@ -145,5 +144,7 @@ async def import_ind():
145144 datas [file ] = json .load (fichier ).get ('data' )
146145
147146 async with aiohttp .ClientSession () as session :
148- for file in cache_files :
149- await process_data (datas [file ], configs [file ], file , session )
147+ # for file in cache_files:
148+ # await process_data(datas[file], configs[file], file, session)
149+ tasks = [process_data (datas [file ], configs [file ], file , session ) for file in cache_files ]
150+ await gather_with_concurrency (10 , tasks )
0 commit comments