mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-30 20:04:47 +00:00
fix handle_release
This commit is contained in:
committed by
Aiden McClelland
parent
99c7fe88a9
commit
dee4ce15bd
@@ -112,8 +112,8 @@ impl Trie {
|
|||||||
lock_info: LockInfo,
|
lock_info: LockInfo,
|
||||||
locks_on_lease: &mut Vec<oneshot::Receiver<LockInfo>>,
|
locks_on_lease: &mut Vec<oneshot::Receiver<LockInfo>>,
|
||||||
) {
|
) {
|
||||||
let (release, reqs) = self.node.handle_release(lock_info, locks_on_lease);
|
let release = self.node.release(lock_info);
|
||||||
for req in reqs {
|
for req in std::mem::take(&mut self.node.reqs) {
|
||||||
self.handle_request(req, locks_on_lease);
|
self.handle_request(req, locks_on_lease);
|
||||||
}
|
}
|
||||||
if let Some(release) = release {
|
if let Some(release) = release {
|
||||||
@@ -187,25 +187,6 @@ impl Node {
|
|||||||
Some(lock_info)
|
Some(lock_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn handle_release(
|
|
||||||
&mut self,
|
|
||||||
lock_info: LockInfo,
|
|
||||||
locks_on_lease: &mut Vec<oneshot::Receiver<LockInfo>>,
|
|
||||||
) -> (Option<LockInfo>, Vec<Request>) {
|
|
||||||
(self.release(lock_info), self.process_queue(locks_on_lease))
|
|
||||||
}
|
|
||||||
fn process_queue(
|
|
||||||
&mut self,
|
|
||||||
locks_on_lease: &mut Vec<oneshot::Receiver<LockInfo>>,
|
|
||||||
) -> Vec<Request> {
|
|
||||||
let mut res = Vec::new();
|
|
||||||
for req in std::mem::take(&mut self.reqs) {
|
|
||||||
if let Some(req) = self.handle_request(req, locks_on_lease) {
|
|
||||||
res.push(req);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
|
|||||||
Reference in New Issue
Block a user