Created
October 7, 2015 20:19
-
-
Save 1st1/1f7eff22b04593f03cc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _RedisPool(aioredis.RedisPool): | |
| @asyncio.coroutine | |
| def acquire(self): | |
| # XXX | |
| with (yield from self._cond): | |
| while True: | |
| yield from self._fill_free(override_min=True) | |
| if self.freesize: | |
| conn = self._pool.popleft() | |
| if conn.closed: | |
| continue | |
| assert conn not in self._used, (conn, self._used) | |
| self._used.add(conn) | |
| return conn | |
| else: | |
| yield from self._cond.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment