8000 Make Redis timeout configurable via environment variable by jbaldassari · Pull Request #71 · withlogicco/ceryx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make Redis timeout configurable via environment variable #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2019

Conversation

jbaldassari
Copy link
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
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
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
0