Skip to content

Commit

Permalink
Merge pull request #646 from tursodatabase/lucio/remove-panic-unwind
Browse files Browse the repository at this point in the history
remove panic = abort
  • Loading branch information
LucioFranco committed Nov 17, 2023
2 parents d39b279 + 510fe69 commit c18553c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ members = [

[profile.release]
codegen-units = 1
panic = "abort"
panic = "unwind"

[workspace.dependencies]
rusqlite = { path = "vendored/rusqlite", version = "0.29", default-features = false, features = [
Expand Down
78 changes: 39 additions & 39 deletions libsql/examples/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,56 @@ async fn main() {
)
.await
.unwrap();
let conn = db.connect().unwrap();
// let conn = db.connect().unwrap();

let f = db.sync().await.unwrap();
println!("inital sync complete, frame no: {f:?}");

conn.execute("CREATE TABLE IF NOT EXISTS foo (x TEXT)", ())
.await
.unwrap();
// conn.execute("CREATE TABLE IF NOT EXISTS foo (x TEXT)", ())
// .await
// .unwrap();

db.sync().await.unwrap();
// db.sync().await.unwrap();

let mut jh = tokio::spawn(async move {
let mut rows = conn
.query(
"INSERT INTO foo (x) VALUES (?1) RETURNING *",
vec![Value::from(
"this value was written by an embedded replica!",
)],
)
.await
.unwrap();
// let mut jh = tokio::spawn(async move {
// let mut rows = conn
// .query(
// "INSERT INTO foo (x) VALUES (?1) RETURNING *",
// vec![Value::from(
// "this value was written by an embedded replica!",
// )],
// )
// .await
// .unwrap();

println!("Rows insert call");
while let Some(row) = rows.next().unwrap() {
println!("Row: {}", row.get_str(0).unwrap());
}
// println!("Rows insert call");
// while let Some(row) = rows.next().unwrap() {
// println!("Row: {}", row.get_str(0).unwrap());
// }

println!("--------");
// println!("--------");

let mut rows = conn.query("SELECT * FROM foo", ()).await.unwrap();
// let mut rows = conn.query("SELECT * FROM foo", ()).await.unwrap();

println!("Rows coming from a read after write call");
while let Some(row) = rows.next().unwrap() {
println!("Row: {}", row.get_str(0).unwrap());
}
// println!("Rows coming from a read after write call");
// while let Some(row) = rows.next().unwrap() {
// println!("Row: {}", row.get_str(0).unwrap());
// }

println!("--------");
});
// println!("--------");
// });

loop {
tokio::select! {
_ = tokio::time::sleep(Duration::from_secs(1)) => {
let r = db.sync().await.unwrap();
println!("replicated until index {r:?}");
}
// loop {
// tokio::select! {
// _ = tokio::time::sleep(Duration::from_secs(1)) => {
// let r = db.sync().await.unwrap();
// println!("replicated until index {r:?}");
// }

r = &mut jh => {
r.unwrap();
return;
}
}
}
// r = &mut jh => {
// r.unwrap();
// return;
// }
// }
// }
}

0 comments on commit c18553c

Please sign in to comment.