Skip to content

Commit

Permalink
close Ws if event stream disconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
jordy25519 committed Feb 13, 2025
1 parent d6b0527 commit 8f45f41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,8 @@ async fn accept_connection(
warn!(target: LOG_TARGET, "event stream finished: {sub_account_id:?}");
subscription_map.lock().await.remove(&sub_account_id);
// the event subscription task has failed
// notify the caller to handle reconnecting
let _ = message_tx.try_send(
Message::Close(None)
);
// close the Ws so client can handle resubscription
let _ = message_tx.try_send(Message::Close(None));
}
});
subscription_map.insert(request.sub_account_id, join_handle);
Expand Down

0 comments on commit 8f45f41

Please sign in to comment.