hydra
hydra copied to clipboard
Allowed talking to redis sentinel by changing the redis client to ioredis.
This pull request is proposed to solve this issue
Problem statement The problem was that the current state of hydra make it very hard for it to work in a high availability environment specifically in talking with redis since the current client that is used does not support redis modes of working in high availability.
Solution So , what this pull request do is that I have changed the main redis client which is node_redis to the more advanced redis client which is ioredis that supports redis cluster mode , and redis redis sentinel. and actually that's all we need to make hydra work in high availability.
change description: The change as said above is just changing the main connection from node_redis to ioredis .I did not to change most of the commands since ioredis have similar api to node_redis I have also used this guide for migrating which shows the difference between both clients.
so the main changes are
- changed the main redis connection
- made new function for handling multi result since it's a bit different also it is backward compatible if we wanted to still use the node_Redis.
- made a new function to handle if we should use .batch if node_Redis and pipeline if ioredis which is the equivalent of .batch in ioredis
- also I have passed the tests so all tests are passing.
Also later on I will be making a small guide to be used on how to install and deploy hydra with redis in high availability environment in kubernetes. Thanks
I have made a commit that removed the white spaces and only the main changes are remaining now.