Skip to content

Commit

Permalink
Do not try to flush on secondary instances
Browse files Browse the repository at this point in the history
  • Loading branch information
GodTamIt committed Nov 22, 2023
1 parent 5c5a5c9 commit f70a519
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/rdict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,11 +1020,14 @@ impl Rdict {
fn close(&mut self) -> PyResult<()> {
let f_opt = &self.flush_opt;
let db = self.get_db()?.borrow();
if let AccessTypeInner::ReadOnly { .. } = self.access_type.0 {
drop(db);
drop(self.column_family.take());
drop(self.db.take());
return Ok(());
match &self.access_type.0 {
AccessTypeInner::ReadOnly { .. } | AccessTypeInner::Secondary { .. } => {
drop(db);
drop(self.column_family.take());
drop(self.db.take());
return Ok(());
}
_ => (),
};
let flush_wal_result = db.flush_wal(true);
let flush_result = if let Some(cf) = &self.column_family {
Expand Down

0 comments on commit f70a519

Please sign in to comment.