Skip to content

Make Redis timeout configurable via environment variable#71

Merged
parisk merged 1 commit into
withlogicco:masterfrom
mablhq:configurable-redis-timeout
Aug 26, 2019
Merged

Make Redis timeout configurable via environment variable#71
parisk merged 1 commit into
withlogicco:masterfrom
mablhq:configurable-redis-timeout

Conversation

@jbaldassari
Copy link
Copy Markdown
Contributor

@jbaldassari jbaldassari commented Aug 25, 2019

I suspect that we're occasionally seeing Redis timeouts due to messages in our Ceryx logs like the following which are associated with HTTP 500 responses from Ceryx:

[error] 25#25: *41967 lua tcp socket connect timed out
/usr/local/openresty/nginx/lualib/router.lua:5: in function </usr/local/openresty/nginx/lualib/router.lua:1>

The line it's referring to is:

local redisClient = redis:client()

Currently the Redis timeout is hard-coded to 100ms here: https://github.com/sourcelair/ceryx/blob/master/ceryx/nginx/lualib/ceryx/redis.lua#L16

I suspect that we're occasionally seeing new connections hit this limit, so I would like to try increasing it, but unfortunately it isn't currently configurable via Ceryx. This PR adds a new environment variable called CERYX_REDIS_TIMEOUT which can be used to configure this timeout in units of milliseconds. I applied this setting to the Ceryx API as well, although the units had to be converted to seconds in that case because that's what the Python Redis client expects.

Copy link
Copy Markdown
Contributor

@parisk parisk left a comment

Choose a reason for hiding this comment

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

Great patch! Thanks for putting the time on this and also updating documentation accordingly.

Merging 🚀!

@parisk parisk merged commit 19d5924 into withlogicco:master Aug 26, 2019
@jbaldassari
Copy link
Copy Markdown
Contributor Author

@parisk and thank you for the quick review and merge!

@jbaldassari jbaldassari deleted the configurable-redis-timeout branch August 26, 2019 17:56
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

Successfully merging this pull request may close these issues.

2 participants