Skip to content

Commit 0c63e3f

Browse files
Fix timing based macOS CI failure.
Signed-off-by: michael-grunder <[email protected]>
1 parent 45b7820 commit 0c63e3f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Diff for: test.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -1276,15 +1276,13 @@ static void test_blocking_connection_timeouts(struct config config) {
12761276
redisContext *c;
12771277
redisReply *reply;
12781278
ssize_t s;
1279-
const char *sleep_cmd = "DEBUG SLEEP 3\r\n";
1280-
struct timeval tv;
1279+
const char *sleep_cmd = "DEBUG SLEEP 1\r\n";
1280+
struct timeval tv = {.tv_sec = 0, .tv_usec = 10000};
12811281

12821282
c = do_connect(config);
12831283
test("Successfully completes a command when the timeout is not exceeded: ");
12841284
reply = redisCommand(c,"SET foo fast");
12851285
freeReplyObject(reply);
1286-
tv.tv_sec = 0;
1287-
tv.tv_usec = 10000;
12881286
redisSetTimeout(c, tv);
12891287
reply = redisCommand(c, "GET foo");
12901288
test_cond(reply != NULL && reply->type == REDIS_REPLY_STRING && memcmp(reply->str, "fast", 4) == 0);
@@ -1302,8 +1300,6 @@ static void test_blocking_connection_timeouts(struct config config) {
13021300
sdsfree(c->obuf);
13031301
c->obuf = sdsempty();
13041302

1305-
tv.tv_sec = 0;
1306-
tv.tv_usec = 10000;
13071303
redisSetTimeout(c, tv);
13081304
reply = redisCommand(c, "GET foo");
13091305
#ifndef _WIN32
@@ -1316,7 +1312,7 @@ static void test_blocking_connection_timeouts(struct config config) {
13161312
freeReplyObject(reply);
13171313

13181314
// wait for the DEBUG SLEEP to complete so that Redis server is unblocked for the following tests
1319-
millisleep(3000);
1315+
millisleep(1100);
13201316
} else {
13211317
test_skipped();
13221318
}

0 commit comments

Comments
 (0)