Skip to content
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

Invalid timeout specified #4588

Open
gitmagox opened this issue Jan 10, 2018 · 2 comments
Open

Invalid timeout specified #4588

gitmagox opened this issue Jan 10, 2018 · 2 comments

Comments

@gitmagox
Copy link

when set timeout = {"1","5000000"} The system is mistaken for "Invalid timeout specified"

if (timeout->tv_usec > 1000000 || timeout->tv_sec > __MAX_MSEC) {
*result = msec;
return REDIS_ERR;
}

Why the maximum value is set to 1000000?

@gitmagox
Copy link
Author

hiredis

@WiFeng
Copy link

WiFeng commented Jan 11, 2018

1second = 1000000 microseconds

struct timeval  {  
    __time_t tv_sec;        /* Seconds. */  
    __suseconds_t tv_usec;  /* Microseconds. */  
};  

If you want to set larger timeout value, you can use first field(tv_sec).
eg. timeout = {2, 1000}

I found an explanation, as follows.
deps/hiredis/examples/example.c

struct timeval timeout = { 1, 500000 }; // 1.5 seconds
    c = redisConnectWithTimeout(hostname, port, timeout);

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

No branches or pull requests

2 participants