Make the redis client use AsyncWrapper and coroutines
Change all log messages to be synchronous
This commit is contained in:
parent
5935e93eb8
commit
f0ef4347e5
8 changed files with 76 additions and 57 deletions
|
@ -1,5 +1,5 @@
|
|||
from functools import partial
|
||||
from trollius import get_event_loop
|
||||
from trollius import get_event_loop, coroutine
|
||||
|
||||
|
||||
class AsyncWrapper(object):
|
||||
|
@ -25,3 +25,8 @@ class AsyncWrapper(object):
|
|||
return self._loop.run_in_executor(self._executor, callable_delegate_attr)
|
||||
|
||||
return wrapper
|
||||
|
||||
@coroutine
|
||||
def __call__(self, *args, **kwargs):
|
||||
callable_delegate_attr = partial(self._delegate, *args, **kwargs)
|
||||
return self._loop.run_in_executor(self._executor, callable_delegate_attr)
|
||||
|
|
Reference in a new issue