Skip to content

Commit 123183a

Browse files
committed
send all pending responses before shutting down
The async implementation doesn't wait for responses to be sent to clients when shutting down. These responses are lost if the application exists fast enough before the write task gets to send them. That means that the response for a request that triggers shutdown of the server might be lost without the client knowing that the server was actually stopped. Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
1 parent 44b31f7 commit 123183a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/asynchronous/server.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,14 @@ impl Builder for ServerBuilder {
327327
server_shutdown: self.shutdown_waiter.clone(),
328328
handler_shutdown: disconnect_notifier,
329329
},
330-
ServerWriter { rx },
330+
ServerWriter { rx, _server_shutdown: self.shutdown_waiter.clone() },
331331
)
332332
}
333333
}
334334

335335
struct ServerWriter {
336336
rx: MessageReceiver,
337+
_server_shutdown: shutdown::Waiter
337338
}
338339

339340
#[async_trait]

0 commit comments

Comments
 (0)