joanvila/aioredlock

maxsize cannot be changed

vartagg opened this issue · 1 comments

Now this parameter for pool is hardoced:

        if self._pool is None:
            async with self._lock:
                if self._pool is None:
                    self.log.debug('Connecting %s', repr(self))
                    self._pool = await self._create_redis_pool(
                        address, **redis_kwargs,
                        minsize=1, maxsize=100)

If I pass maxsize as kwargs, using

    redis_instances = [
        {'host': redis_config['host'], 'port': redis_config['port'], 'db': redis_config['db'], 'maxsize': 5}
    ]

    lock_manager = Aioredlock(redis_instances, lock_timeout=60)

then the error is happening:
TypeError: _create_redis_pool() got multiple values for keyword argument 'maxsize'

As a work around, you can create your own redis pool, and pass that in as your redis_instances, and AioRedlock will use that instead of creating another pool.

https://aioredis.readthedocs.io/en/v1.3.0/api_reference.html#aioredis.create_redis_pool

I have also included fixing this in #75 as just a tangential thing, since I was already including minsize and maxsize in the handling of Sentinels.