mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-12-01 22:14:04 +03:00
Refactor Singleton provider to use async mode api
This commit is contained in:
parent
e4fd36555f
commit
cf69a63915
File diff suppressed because it is too large
Load Diff
|
@ -2168,7 +2168,6 @@ cdef class BaseSingleton(Provider):
|
||||||
def _async_init_instance(self, future_result, result):
|
def _async_init_instance(self, future_result, result):
|
||||||
instance = result.result()
|
instance = result.result()
|
||||||
self.__storage = instance
|
self.__storage = instance
|
||||||
self.__async = True
|
|
||||||
future_result.set_result(instance)
|
future_result.set_result(instance)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2236,11 +2235,6 @@ cdef class Singleton(BaseSingleton):
|
||||||
|
|
||||||
self.__storage = instance
|
self.__storage = instance
|
||||||
|
|
||||||
if self.__async:
|
|
||||||
result = asyncio.Future()
|
|
||||||
result.set_result(self.__storage)
|
|
||||||
return result
|
|
||||||
|
|
||||||
return self.__storage
|
return self.__storage
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user