mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-04-26 04:08:00 +00:00
Flume fix part 2: avoid using flume in a couple of cases, and revert attempted fix#1 (#396)
* A second attempt to avoid the flume memory leak, since the first didn't actually work * No luck with second flume fix, so revert to futures::mpsc in a few places) * cargo fmt * Add a comment to cover use of into_stream
This commit is contained in:
@@ -21,7 +21,7 @@ use std::{
|
||||
|
||||
use crate::feed_message_de::FeedMessage;
|
||||
use common::ws_client;
|
||||
use futures::{Stream, StreamExt};
|
||||
use futures::{channel, Stream, StreamExt};
|
||||
|
||||
/// Wrap a `ws_client::Sender` with convenient utility methods for shard connections
|
||||
pub struct ShardSender(ws_client::Sender);
|
||||
@@ -37,7 +37,7 @@ impl ShardSender {
|
||||
pub fn send_json_binary(
|
||||
&mut self,
|
||||
json: serde_json::Value,
|
||||
) -> Result<(), flume::SendError<ws_client::SentMessage>> {
|
||||
) -> Result<(), channel::mpsc::SendError> {
|
||||
let bytes = serde_json::to_vec(&json).expect("valid bytes");
|
||||
self.unbounded_send(ws_client::SentMessage::Binary(bytes))
|
||||
}
|
||||
@@ -45,7 +45,7 @@ impl ShardSender {
|
||||
pub fn send_json_text(
|
||||
&mut self,
|
||||
json: serde_json::Value,
|
||||
) -> Result<(), flume::SendError<ws_client::SentMessage>> {
|
||||
) -> Result<(), channel::mpsc::SendError> {
|
||||
let s = serde_json::to_string(&json).expect("valid string");
|
||||
self.unbounded_send(ws_client::SentMessage::Text(s))
|
||||
}
|
||||
@@ -123,7 +123,7 @@ impl FeedSender {
|
||||
&self,
|
||||
command: S,
|
||||
param: S,
|
||||
) -> Result<(), flume::SendError<ws_client::SentMessage>> {
|
||||
) -> Result<(), channel::mpsc::SendError> {
|
||||
self.unbounded_send(ws_client::SentMessage::Text(format!(
|
||||
"{}:{}",
|
||||
command.as_ref(),
|
||||
|
||||
Reference in New Issue
Block a user