fix requests being dropped

This commit is contained in:
Aiden McClelland
2021-09-27 13:47:26 -06:00
parent 40bf0d2538
commit 96ab78f8b0
2 changed files with 10 additions and 7 deletions

View File

@@ -152,7 +152,14 @@ pub struct PatchDbHandle {
pub(crate) db: PatchDb,
pub(crate) locks: Vec<Guard>,
}
impl std::fmt::Debug for PatchDbHandle {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("PatchDbHandle")
.field("id", &self.id)
.field("locks", &self.locks)
.finish()
}
}
#[async_trait]
impl DbHandle for PatchDbHandle {
async fn begin<'a>(&'a mut self) -> Result<Transaction<&'a mut Self>, Error> {

View File

@@ -200,12 +200,8 @@ impl Node {
) -> Vec<Request> {
let mut res = Vec::new();
for req in std::mem::take(&mut self.reqs) {
if (req.lock_info.write() && self.write_available(req.lock_info.handle_id))
|| self.read_available(req.lock_info.handle_id)
{
if let Some(req) = self.handle_request(req, locks_on_lease) {
res.push(req);
}
if let Some(req) = self.handle_request(req, locks_on_lease) {
res.push(req);
}
}
res