Added a timeout for the redis-client connection

refactored a bit too