Skip to content

Commit

Permalink
Merge branch 'main' into create-backup-server
Browse files Browse the repository at this point in the history
  • Loading branch information
tripledoublev authored Dec 4, 2024
2 parents fef8072 + 094b4ed commit 7693584
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl Backend {

let on_new_route_callback: OnNewRouteCallback = Arc::new(move |route_id, route_id_blob| {
let inner = inner_clone.clone();
println!("Re-generating route");
tokio::spawn(async move {
let inner = inner.lock().await;

Expand Down Expand Up @@ -159,7 +160,9 @@ impl Backend {
});

let (route_id, route_id_blob) = make_route(&veilid_api).await?;
let routing_context = veilid_api.routing_context()?;
let routing_context = veilid_api
.routing_context()?
.with_sequencing(veilid_core::Sequencing::EnsureOrdered);

let mut inner = backend.inner.lock().await;

Expand Down Expand Up @@ -203,12 +206,15 @@ impl Backend {
let (route_id, route_id_blob) = make_route(&veilid_api).await?;

// Get veilid_api and routing_context
let routing_context = veilid_api.routing_context()?;
let routing_context = veilid_api
.routing_context()?
.with_sequencing(veilid_core::Sequencing::EnsureOrdered);

let inner_clone = self.inner.clone();

let on_new_route_callback: OnNewRouteCallback = Arc::new(move |route_id, route_id_blob| {
let inner = inner_clone.clone();
println!("Re-generating route");
tokio::spawn(async move {
let inner = inner.lock().await;

Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,8 @@ mod tests {

let mut peer_repo = group.create_repo().await?;

sleep(Duration::from_secs(1)).await;

let group2 = backend2.join_from_url(&group.get_url()).await?;

// Upload a test blob to the peer repo
Expand Down Expand Up @@ -966,6 +968,8 @@ mod tests {
"New collection hash after uploading a file should not be empty"
);

sleep(Duration::from_secs(4)).await;

let joined_group = backend2
.join_from_url(&group1.get_url())
.await
Expand Down
3 changes: 1 addition & 2 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,8 @@ impl Repo {
// Method to retrieve a file's hash from the collection
pub async fn get_file_hash(&self, file_name: &str) -> Result<Hash> {
// Ensure the collection exists before reading
self.get_or_create_collection().await?;
let collection_hash = self.get_or_create_collection().await?;

let collection_hash = self.get_collection_hash().await?;
self.iroh_blobs
.get_file_from_collection_hash(&collection_hash, file_name)
.await
Expand Down

0 comments on commit 7693584

Please sign in to comment.