Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4806

Running independent endpoint requests on parallel in Python [duplicate]

$
0
0

I have a functions which is being accessed using REST API methodology by Fast API. Right now, when user request my endpoints, each method is processed synchronously.

async def endpoint1(param1, param2):    return await some_async_method1()
async def endpoint2(param1, param2):    return await some_async_method2()

etc.

I have tried asyncio gather, however, I do not know when or which endpoints will be called. Thus, I cannot give list of methods to the asyncio gather method.

I have tried ThreadPoolExecutor, I kept loosing the return values.


Viewing all articles
Browse latest Browse all 4806

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>