Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d428903

Browse files
committed
Move raftable connection dropping earlier in the code to prevent non-leader from processing the queries.
1 parent 9a6aa45 commit d428903

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

contrib/raftable/worker.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,12 @@ static bool tick(int timeout_ms)
389389
int numready;
390390
Client *c;
391391
bool raft_ready = false;
392-
393-
fd_set readfds = server.all;
392+
fd_set readfds;
394393
struct timeval timeout = ms2tv(timeout_ms);
394+
395+
drop_bads();
396+
397+
readfds = server.all;
395398
numready = select(server.maxfd + 1, &readfds, NULL, NULL, &timeout);
396399
if (numready == -1)
397400
{
@@ -423,8 +426,6 @@ static bool tick(int timeout_ms)
423426
c++;
424427
}
425428

426-
drop_bads();
427-
428429
return raft_ready;
429430
}
430431

0 commit comments

Comments
 (0)