Skip to content

Commit

Permalink
fix(fetcher): forward every imptr to demuxer
Browse files Browse the repository at this point in the history
  • Loading branch information
qti3e committed May 29, 2024
1 parent 94dbfe3 commit 017089f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions core/fetcher/src/origin.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::{HashMap, VecDeque};

use lightning_interfaces::prelude::*;
use lightning_interfaces::types::{Blake3Hash, ImmutablePointer, OriginProvider};
use lightning_interfaces::types::{Blake3Hash, ImmutablePointer};
use lightning_interfaces::OriginProviderSocket;
use tokio::sync::{broadcast, mpsc, oneshot};
use tokio::task::JoinSet;
Expand Down Expand Up @@ -99,13 +99,10 @@ impl<C: Collection> OriginFetcher<C> {
async fn spawn(&mut self, pointer: ImmutablePointer) {
let origin_socket = self.origin_socket.clone();
self.tasks.spawn(async move {
match &pointer.origin {
OriginProvider::IPFS => match origin_socket.run(pointer.clone()).await {
Ok(Ok(hash)) => Ok(SuccessResponse { pointer, hash }),
Ok(Err(_)) => Err(ErrorResponse::OriginFetchError(pointer.uri)),
Err(_) => Err(ErrorResponse::OriginSocketError),
},
_ => unreachable!(),
match origin_socket.run(pointer.clone()).await {
Ok(Ok(hash)) => Ok(SuccessResponse { pointer, hash }),
Ok(Err(_)) => Err(ErrorResponse::OriginFetchError(pointer.uri)),
Err(_) => Err(ErrorResponse::OriginSocketError),
}
});
}
Expand Down

0 comments on commit 017089f

Please sign in to comment.