mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-22 14:40:50 +03:00
Refactor ThreadLocalSingleton provider to use async mode api
This commit is contained in:
parent
913b562369
commit
3da1698f95
File diff suppressed because it is too large
Load Diff
|
@ -2388,16 +2388,11 @@ cdef class ThreadLocalSingleton(BaseSingleton):
|
|||
|
||||
self.__storage.instance = instance
|
||||
finally:
|
||||
if self.__async:
|
||||
result = asyncio.Future()
|
||||
result.set_result(instance)
|
||||
return result
|
||||
return instance
|
||||
|
||||
def _async_init_instance(self, future_result, result):
|
||||
instance = result.result()
|
||||
self.__storage.instance = instance
|
||||
self.__async = True
|
||||
future_result.set_result(instance)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user