Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid empty set on multi_cached #490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Apr 22, 2020

  1. Avoid empty set on multi_cached

    The multi_cached decorator was always writing in the cache the result of the function, even if it was empty. This was causing the following error inside aioredis:
    
    ERROR    aiocache.decorators:decorators.py:370 Couldn't set {}, unexpected error
    Traceback (most recent call last):
      File "/Users/josepcugat/workspace/aiocache/aiocache/decorators.py", line 367, in set_in_cache
        ttl=self.ttl,
      File "/Users/josepcugat/workspace/aiocache/aiocache/base.py", line 61, in _enabled
        return await func(*args, **kwargs)
      File "/Users/josepcugat/workspace/aiocache/aiocache/base.py", line 45, in _timeout
        return await asyncio.wait_for(func(self, *args, **kwargs), timeout)
      File "/Users/josepcugat/.pyenv/versions/3.6.8/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
        return fut.result()
      File "/Users/josepcugat/workspace/aiocache/aiocache/base.py", line 75, in _plugins
        ret = await func(self, *args, **kwargs)
      File "/Users/josepcugat/workspace/aiocache/aiocache/base.py", line 300, in multi_set
        await self._multi_set(tmp_pairs, ttl=self._get_ttl(ttl), _conn=_conn)
      File "/Users/josepcugat/workspace/aiocache/aiocache/backends/redis.py", line 24, in wrapper
        return await func(self, *args, _conn=_conn, **kwargs)
      File "/Users/josepcugat/workspace/aiocache/aiocache/backends/redis.py", line 140, in _multi_set
        await _conn.mset(*flattened)
      File "/Users/josepcugat/.pyenv/versions/3.6.8/envs/aiocache/lib/python3.6/site-packages/aioredis/util.py", line 52, in wait_ok
        res = await fut
    aioredis.errors.ReplyError: ERR wrong number of arguments for 'mset' command
    Josep Cugat committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    0108a04 View commit details
    Browse the repository at this point in the history