Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Conversation

@burdettadam
Copy link
Collaborator

cleaned up some code and added an error for failed configurations and cache key-value setting.

Signed-off-by: Adam Burdett <burdettadam@gmail.com>
Signed-off-by: Adam Burdett <burdettadam@gmail.com>
Signed-off-by: Adam Burdett <burdettadam@gmail.com>
@burdettadam burdettadam requested a review from TheTechmage May 11, 2022 06:51

raise RedisCacheConfigurationError(
"Configuration missing for redis queue"
) from error
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of the problem with combining all of these is that it makes username/passwords/SSL required configuration options. Most people when using redis just end up using the default user with no password and they don't bother setting up SSL. This would have been the case had I done my development with containers, but using my own redis server presented the complications of more strict security settings. The only config option that was required here was config["connection"]. All other options {credentials:{username,password}, ssl:{cacerts}} are (and should be) optional.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aww! I understand the catch and pass now. there is an unused ssl.context hanging around, I assumed there was more at hand than I saw. I agree with you on the optional configs.

# self._cache[key] = {"expires": expires_ts, "value": value}
await self.redis.set(f"ACA-Py:{key}", json.dumps(value), ex=ttl)
except aioredis.RedisError as error:
raise RedisCacheSetKeyValueError("Unexpected redis client exception") from error
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Should there be one for the GET command as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not sure if not getting something would be an error. maybe a connection to Redis died and we could wrap that error with a get. Not sure. I think I am in favor of another error type for 'get'.

@TheTechmage TheTechmage merged commit aa19fd8 into main May 12, 2022
@TheTechmage TheTechmage deleted the feature/cleanup branch June 8, 2022 13:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants