node: Don't re-queue fetch that is already queued
This commit is contained in:
parent
e19c773a86
commit
ef1ed621d7
|
|
@ -281,6 +281,16 @@ struct QueuedFetch {
|
||||||
channel: Option<chan::Sender<FetchResult>>,
|
channel: Option<chan::Sender<FetchResult>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq for QueuedFetch {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.rid == other.rid
|
||||||
|
&& self.from == other.from
|
||||||
|
&& self.refs_at == other.refs_at
|
||||||
|
&& self.channel.is_none()
|
||||||
|
&& other.channel.is_none()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Holds all node stores.
|
/// Holds all node stores.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Stores<D>(D);
|
pub struct Stores<D>(D);
|
||||||
|
|
@ -907,13 +917,18 @@ where
|
||||||
fetching.subscribe(c);
|
fetching.subscribe(c);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug!(target: "service", "Queueing fetch for {rid} with {from}..");
|
let fetch = QueuedFetch {
|
||||||
self.queue.push_back(QueuedFetch {
|
|
||||||
rid,
|
rid,
|
||||||
refs_at,
|
refs_at,
|
||||||
from,
|
from,
|
||||||
channel,
|
channel,
|
||||||
});
|
};
|
||||||
|
if self.queue.contains(&fetch) {
|
||||||
|
debug!(target: "service", "Fetch for {rid} with {from} is already queued..");
|
||||||
|
} else {
|
||||||
|
debug!(target: "service", "Queueing fetch for {rid} with {from}..");
|
||||||
|
self.queue.push_back(fetch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(TryFetchError::SessionCapacityReached) => {
|
Err(TryFetchError::SessionCapacityReached) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue