mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-02-25 00:12:58 +08:00
FoundationDB fixes
This commit is contained in:
parent
1e908f7737
commit
cf6765b70d
3 changed files with 4 additions and 8 deletions
|
@ -202,10 +202,6 @@ impl<T, E: Display> UnwrapResult<T> for Result<T, E> {
|
|||
}
|
||||
}
|
||||
|
||||
trait TableName {
|
||||
fn table_name(&self) -> &'static str;
|
||||
}
|
||||
|
||||
pub fn read_file(path: &str) -> Vec<u8> {
|
||||
if path == "-" {
|
||||
let mut stdin = std::io::stdin().lock();
|
||||
|
|
|
@ -50,7 +50,7 @@ impl ReadVersion {
|
|||
pub fn new(version: i64) -> Self {
|
||||
Self {
|
||||
version,
|
||||
expires: Instant::now() + Duration::from_secs(60 * 2),
|
||||
expires: Instant::now() + Duration::from_secs(1),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,19 +142,19 @@ impl FdbStore {
|
|||
}
|
||||
|
||||
pub(crate) async fn read_trx(&self) -> crate::Result<Transaction> {
|
||||
let trx = self.db.create_trx()?;
|
||||
let (is_expired, mut read_version) = {
|
||||
let version = self.version.lock();
|
||||
(version.is_expired(), version.version)
|
||||
};
|
||||
let trx = self.db.create_trx()?;
|
||||
|
||||
if is_expired {
|
||||
read_version = trx.get_read_version().await?;
|
||||
*self.version.lock() = ReadVersion::new(read_version);
|
||||
} else {
|
||||
trx.set_read_version(read_version);
|
||||
}
|
||||
|
||||
trx.set_read_version(read_version);
|
||||
|
||||
Ok(trx)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue