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

DEGRADE_ON_FAILURE seems to be much broader #167

Closed
th13f opened this issue Oct 20, 2015 · 4 comments
Closed

DEGRADE_ON_FAILURE seems to be much broader #167

th13f opened this issue Oct 20, 2015 · 4 comments

Comments

@th13f
Copy link

th13f commented Oct 20, 2015

There are DEGRADE_ON_FAILURE setting. This helps to handle redis errors: timeout/etc. But on heroku, connections limit problem is very actual. When this happens i've got
ResponseError: max number of clients reached error
this is also redis error such as ConnectionError/TimeoutError. Would be great to support this exception or catch RedisError at all.
cacheops version 2.4.2, django 1.7.7, python 2.7.6

there is partial stacktrace

  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 966, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/app/.heroku/python/lib/python2.7/site-packages/cacheops/query.py", line 255, in iterator
    cache_data = redis_client.get(cache_key)
  File "/app/.heroku/python/lib/python2.7/site-packages/funcy/decorators.py", line 28, in wrapper
    return deco(call, *dargs, **dkwargs)
  File "/app/.heroku/python/lib/python2.7/site-packages/cacheops/conf.py", line 41, in handle_connection_failure
    return call()
  File "/app/.heroku/python/lib/python2.7/site-packages/funcy/decorators.py", line 46, in __call__
    return self._func(*self._args, **self._kwargs)
  File "/app/.heroku/python/lib/python2.7/site-packages/redis/client.py", line 863, in get
    return self.execute_command('GET', name)
  File "/app/.heroku/python/lib/python2.7/site-packages/redis/client.py", line 564, in execute_command
    connection.send_command(*args)
  File "/app/.heroku/python/lib/python2.7/site-packages/redis/connection.py", line 556, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/app/.heroku/python/lib/python2.7/site-packages/redis/connection.py", line 532, in send_packed_command
    self.connect()
  File "/app/.heroku/python/lib/python2.7/site-packages/redis/connection.py", line 440, in connect
    self.on_connect()
  File "/app/.heroku/python/lib/python2.7/site-packages/redis/connection.py", line 508, in on_connect
    if nativestr(self.read_response()) != 'OK':
  File "/app/.heroku/python/lib/python2.7/site-packages/redis/connection.py", line 574, in read_response
    raise response
ResponseError: max number of clients reached
@Suor
Copy link
Owner

Suor commented Oct 20, 2015

So you want DEGRADE_ON_FAILURE to catch that? I don't mind, are you willing to make a pull request?

@th13f
Copy link
Author

th13f commented Oct 20, 2015

Yes, seems logical for me to use DEGRADE_ON_FAILURE to catch this error. I will make pull request if you approve this way as normal.

@Suor
Copy link
Owner

Suor commented Oct 20, 2015

Ok, so be it.

@Suor
Copy link
Owner

Suor commented Nov 2, 2015

So this is fixed in redis/redis-py#669.

@Suor Suor closed this as completed Nov 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants