Skip to content

Commit

Permalink
Fix a hang during migration 14 for new users
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Oct 23, 2023
1 parent 060a315 commit 1ff2f1d
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions gossip-lib/src/storage/migrations/deprecated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,12 @@ impl Storage {
match self.general.get(&txn, b"last_contact_list_edit")? {
None => {
let now = Unixtime::now().unwrap();
self.write_last_contact_list_edit(now.0, None)?;
Ok(now.0)
}
Some(bytes) => Ok(i64::from_be_bytes(bytes[..8].try_into().unwrap())),
}
}

/// Write the user's last MuteList edit time
/// DEPRECATED - use set_person_list_last_edit_time instead
pub(in crate::storage) fn write_last_mute_list_edit<'a>(
&'a self,
when: i64,
rw_txn: Option<&mut RwTxn<'a>>,
) -> Result<(), Error> {
let bytes = when.to_be_bytes();

let f = |txn: &mut RwTxn<'a>| -> Result<(), Error> {
self.general
.put(txn, b"last_mute_list_edit", bytes.as_slice())?;
Ok(())
};

match rw_txn {
Some(txn) => f(txn)?,
None => {
let mut txn = self.env.write_txn()?;
f(&mut txn)?;
txn.commit()?;
}
};

Ok(())
}

/// Read the user's last MuteList edit time
/// DEPRECATED - use get_person_list_last_edit_time instead
pub(in crate::storage) fn read_last_mute_list_edit(&self) -> Result<i64, Error> {
Expand All @@ -81,7 +53,6 @@ impl Storage {
match self.general.get(&txn, b"last_mute_list_edit")? {
None => {
let now = Unixtime::now().unwrap();
self.write_last_mute_list_edit(now.0, None)?;
Ok(now.0)
}
Some(bytes) => Ok(i64::from_be_bytes(bytes[..8].try_into().unwrap())),
Expand Down

0 comments on commit 1ff2f1d

Please sign in to comment.