Permalink
Browse files

add option for poolsize (#176)

  • Loading branch information...
rnehra01 authored and afeena committed Jul 21, 2017
1 parent fc629f0 commit a88bbdc31c1ebda0c00b57abfc033081e1821845
Showing with 4 additions and 3 deletions.
  1. +3 −2 tanner/redis_client.py
  2. +1 −1 tanner/web/server.py
View
@@ -10,12 +10,13 @@
class RedisClient:
@staticmethod
async def get_redis_client():
async def get_redis_client(poolsize=None):
redis_client = None
try:
host = TannerConfig.get('REDIS', 'host')
port = TannerConfig.get('REDIS', 'port')
poolsize = TannerConfig.get('REDIS', 'poolsize')
if poolsize is None:
poolsize = TannerConfig.get('REDIS', 'poolsize')
timeout = TannerConfig.get('REDIS', 'timeout')
redis_client = await asyncio.wait_for(asyncio_redis.Pool.create(
host=host, port=int(port), poolsize=int(poolsize)), timeout=int(timeout))
View
@@ -92,7 +92,7 @@ def create_app(self, loop):
def start(self):
loop = asyncio.get_event_loop()
self.redis_client = loop.run_until_complete(redis_client.RedisClient.get_redis_client())
self.redis_client = loop.run_until_complete(redis_client.RedisClient.get_redis_client(poolsize=20))
self.api = api.Api(self.redis_client)
app = self.create_app(loop)
host = TannerConfig.get('WEB', 'host')

0 comments on commit a88bbdc

Please sign in to comment.