Skip to content

Commit

Permalink
there's no way this is gonna work, right?
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed Nov 16, 2023
1 parent 67dfe7c commit 3b96586
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 97 deletions.
7 changes: 5 additions & 2 deletions crates/corro-agent/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use tokio::{
net::TcpListener,
sync::{
mpsc::{channel, Receiver, Sender},
watch,
watch, Semaphore,
},
task::block_in_place,
time::{error::Elapsed, sleep, timeout},
Expand Down Expand Up @@ -119,7 +119,9 @@ pub async fn setup(conf: Config, tripwire: Tripwire) -> eyre::Result<(Agent, Age

info!("Actor ID: {}", actor_id);

let pool = SplitPool::create(&conf.db.path, tripwire.clone()).await?;
let write_sema = Arc::new(Semaphore::new(1));

let pool = SplitPool::create(&conf.db.path, write_sema.clone(), tripwire.clone()).await?;

let schema = {
let mut conn = pool.write_priority().await?;
Expand Down Expand Up @@ -319,6 +321,7 @@ pub async fn setup(conf: Config, tripwire: Tripwire) -> eyre::Result<(Agent, Age
tx_empty,
tx_changes,
tx_foca,
write_sema,
schema: RwLock::new(schema),
tripwire,
});
Expand Down
Loading

0 comments on commit 3b96586

Please sign in to comment.