Skip to content
This repository has been archived by the owner on Aug 5, 2023. It is now read-only.

Commit

Permalink
Don't cache error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
gusutabopb committed Apr 10, 2019
1 parent 67dda02 commit be7b87c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aioinflux/client.py
Expand Up @@ -365,8 +365,9 @@ async def _chunked_generator(url, data):
data = await resp.read()
if use_cache and self._redis:
logger.debug(f'Cache MISS ({resp.status}): {q}')
await self._redis.set(key, lz4.compress(data))
await self._redis.expire(key, self.cache_expiry)
if resp.status == 200:
await self._redis.set(key, lz4.compress(data))
await self._redis.expire(key, self.cache_expiry)
else:
logger.debug(f'{resp.status}: {q}')

Expand Down

0 comments on commit be7b87c

Please sign in to comment.