Skip to content

Commit

Permalink
Revert to async channels for now
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Jan 4, 2024
1 parent b33dd05 commit 10e61c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions nautilus_core/common/src/msgbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::{
collections::HashMap,
fmt,
hash::{Hash, Hasher},
sync::mpsc::{sync_channel, Receiver, SendError, SyncSender},
sync::mpsc::{channel, Receiver, SendError, Sender},
thread,
};

Expand Down Expand Up @@ -131,7 +131,7 @@ impl fmt::Display for BusMessage {
/// For example, `c??p` would match both of the above examples and `coop`.
#[derive(Clone)]
pub struct MessageBus {
tx: Option<SyncSender<BusMessage>>,
tx: Option<Sender<BusMessage>>,
/// mapping from topic to the corresponding handler
/// a topic can be a string with wildcards
/// * '?' - any character
Expand Down Expand Up @@ -176,7 +176,7 @@ impl MessageBus {
let config = config.unwrap_or_default();
let has_backing = config.get("database").map_or(false, |v| v != &Value::Null);
let tx = if has_backing {
let (tx, rx) = sync_channel::<BusMessage>(0);
let (tx, rx) = channel::<BusMessage>();
thread::spawn(move || {
Self::handle_messages(rx, trader_id, instance_id, config);
});
Expand Down
6 changes: 3 additions & 3 deletions nautilus_core/infrastructure/src/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use std::{
collections::{HashMap, VecDeque},
sync::mpsc::{sync_channel, Receiver, SyncSender, TryRecvError},
sync::mpsc::{channel, Receiver, Sender, TryRecvError},
thread,
time::{Duration, Instant},
};
Expand Down Expand Up @@ -72,7 +72,7 @@ pub struct RedisCacheDatabase {
pub trader_id: TraderId,
trader_key: String,
conn: Connection,
tx: SyncSender<DatabaseCommand>,
tx: Sender<DatabaseCommand>,
}

impl CacheDatabase for RedisCacheDatabase {
Expand All @@ -87,7 +87,7 @@ impl CacheDatabase for RedisCacheDatabase {
let client = redis::Client::open(redis_url)?;
let conn = client.get_connection().unwrap();

let (tx, rx) = sync_channel::<DatabaseCommand>(0);
let (tx, rx) = channel::<DatabaseCommand>();
let trader_key = get_trader_key(trader_id, instance_id, &config);
let trader_key_clone = trader_key.clone();

Expand Down

0 comments on commit 10e61c8

Please sign in to comment.