mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 02:11:54 +00:00
don't send empty patches
This commit is contained in:
Submodule json-patch updated: 2065db49ff...4f762cf7bc
@@ -211,6 +211,10 @@ impl DiffPatch {
|
||||
}
|
||||
keys
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.is_empty()
|
||||
}
|
||||
}
|
||||
impl Default for DiffPatch {
|
||||
fn default() -> Self {
|
||||
|
||||
@@ -7,7 +7,11 @@ use crate::Revision;
|
||||
struct ScopedSender(JsonPointer, mpsc::UnboundedSender<Revision>);
|
||||
impl ScopedSender {
|
||||
fn send(&self, revision: &Revision) -> Result<(), mpsc::error::SendError<Revision>> {
|
||||
self.1.send(revision.for_path(&self.0))
|
||||
let scoped = revision.for_path(&self.0);
|
||||
if scoped.patch.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
self.1.send(scoped)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user