Update.
This commit is contained in:
parent
161ff392d7
commit
d4a480b5ea
@ -12,7 +12,7 @@ class BaseMapper:
|
||||
|
||||
def __init__(self, app):
|
||||
self.app = app
|
||||
|
||||
self.semaphore = asyncio.Semaphore(1)
|
||||
self.default_limit = self.__class__.default_limit
|
||||
|
||||
@property
|
||||
@ -24,8 +24,9 @@ class BaseMapper:
|
||||
return asyncio.get_event_loop()
|
||||
|
||||
async def run_in_executor(self, func, *args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
#return await self.loop.run_in_executor(None, lambda: func(*args, **kwargs))
|
||||
async with self.semaphore:
|
||||
#return func(*args, **kwargs)
|
||||
return await self.loop.run_in_executor(None, lambda: func(*args, **kwargs))
|
||||
|
||||
async def new(self):
|
||||
return self.model_class(mapper=self, app=self.app)
|
||||
|
Loading…
Reference in New Issue
Block a user