Skip to content

Commit c625922

Browse files
Copilot0xrinegade
andcommitted
Fix WebSocket benchmark compilation errors and remove unused function
- Fix tungstenite v0.27 API compatibility by adding .into() for Message::Text - Remove unused ws_connection_timeout function to eliminate dead code warning - All 6 compilation errors in websocket_bench.rs resolved - All benchmarks now compile successfully Co-authored-by: 0xrinegade <[email protected]>
1 parent f49fa01 commit c625922

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

benches/websocket_bench.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn bench_websocket_subscriptions(c: &mut Criterion) {
7878
let (mut ws_stream, _) = connect_websocket(port).await.expect("Failed to connect");
7979

8080
// Send subscription request
81-
let message = Message::Text(req.to_string());
81+
let message = Message::Text(req.to_string().into());
8282
ws_stream.send(message).await.expect("Failed to send message");
8383

8484
// Wait for response
@@ -129,7 +129,7 @@ fn bench_websocket_unsubscribe(c: &mut Criterion) {
129129
let (mut ws_stream, _) = connect_websocket(port).await.expect("Failed to connect");
130130

131131
// Send unsubscribe request
132-
let message = Message::Text(req.to_string());
132+
let message = Message::Text(req.to_string().into());
133133
ws_stream.send(message).await.expect("Failed to send message");
134134

135135
// Wait for response
@@ -170,7 +170,7 @@ fn bench_websocket_throughput(c: &mut Criterion) {
170170
for i in 0..count {
171171
let mut req = request.clone();
172172
req["id"] = json!(i + 1);
173-
let message = Message::Text(req.to_string());
173+
let message = Message::Text(req.to_string().into());
174174
ws_stream.send(message).await.expect("Failed to send message");
175175
}
176176

@@ -215,7 +215,7 @@ fn bench_concurrent_connections(c: &mut Criterion) {
215215
"params": {}
216216
});
217217

218-
let message = Message::Text(request.to_string());
218+
let message = Message::Text(request.to_string().into());
219219
ws_stream.send(message).await.expect("Failed to send message");
220220

221221
// Wait for response
@@ -259,7 +259,7 @@ fn bench_websocket_error_handling(c: &mut Criterion) {
259259
b.to_async(&rt).iter(|| async {
260260
let (mut ws_stream, _) = connect_websocket(port).await.expect("Failed to connect");
261261

262-
let message = Message::Text(invalid_method_request.to_string());
262+
let message = Message::Text(invalid_method_request.to_string().into());
263263
ws_stream.send(message).await.expect("Failed to send message");
264264

265265
// Wait for error response
@@ -276,7 +276,7 @@ fn bench_websocket_error_handling(c: &mut Criterion) {
276276
b.to_async(&rt).iter(|| async {
277277
let (mut ws_stream, _) = connect_websocket(port).await.expect("Failed to connect");
278278

279-
let message = Message::Text("{invalid json".to_string());
279+
let message = Message::Text("{invalid json".to_string().into());
280280
ws_stream.send(message).await.expect("Failed to send message");
281281

282282
// Wait for error response

src/websocket_server.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ type SubscriptionManager = Arc<DashMap<u64, Subscription>>;
4141
/// Global subscription counter
4242
static SUBSCRIPTION_COUNTER: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);
4343

44-
/// WebSocket connection timeout
45-
fn ws_connection_timeout(config: &crate::config::Config) -> Duration {
46-
Duration::from_secs(config.timeouts.websocket_connection_seconds)
47-
}
48-
4944
/// WebSocket message timeout
5045
fn ws_message_timeout(config: &crate::config::Config) -> Duration {
5146
Duration::from_secs(config.timeouts.websocket_message_seconds)

0 commit comments

Comments
 (0)