-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(server): add connections send timeout #4874
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
Conversation
Signed-off-by: adi_holden <[email protected]>
src/server/server_state.cc
Outdated
@@ -262,8 +265,9 @@ void ServerState::ConnectionsWatcherFb(util::ListenerInterface* main) { | |||
is_replica = dfly_conn->cntx()->replica_conn; | |||
} | |||
|
|||
if ((phase == Phase::READ_SOCKET || dfly_conn->IsSending()) && !is_replica && | |||
dfly_conn->idle_time() > timeout) { | |||
if ((timeout != 0 && phase == Phase::READ_SOCKET && !is_replica && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please factor out into 2 boolean variables for clarity: idle_read
and stuck_sending
btw, I think for stuck_sending
you also need !is_replica
because we have a different setting to break replication connections.
|
||
async def get_task(): | ||
while True: | ||
writer.write(f"GET a\n".encode()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see we use await writer.drain()
after calling write
@dfly_args({"send_timeout": 3}) | ||
async def test_send_timeout(df_server, async_client: aioredis.Redis): | ||
reader, writer = await asyncio.open_connection("127.0.0.1", df_server.port) | ||
writer.write(f"client setname writer_test\n".encode()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await writer.drain()
here
Signed-off-by: adi_holden <[email protected]>
fixes #4828