Skip to content

Commit

Permalink
chore: Spawn tokio tasks for each received trading message
Browse files Browse the repository at this point in the history
Spawning a new tokio task when processing a message prevents us from potentially blocking trading requests as the trading module might still be busy processing the last request.
  • Loading branch information
holzeis committed Sep 14, 2023
1 parent 2be5881 commit f21358c
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 193 deletions.
2 changes: 1 addition & 1 deletion coordinator/src/bin/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async fn main() -> Result<()> {
});

let (tx_price_feed, _rx) = broadcast::channel(100);
let (_handle, trading_sender) = trading::Trading::start(pool.clone(), tx_price_feed.clone());
let (_handle, trading_sender) = trading::start(pool.clone(), tx_price_feed.clone());

tokio::spawn({
let node = node.clone();
Expand Down
Loading

0 comments on commit f21358c

Please sign in to comment.