sqlite3: only update when SearchBackend is sqlite3

jmap-eventsource
Manos Pitsidianakis 2020-09-18 18:39:27 +03:00
parent 8eb78ae01b
commit 82cd690005
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 7 additions and 7 deletions

View File

@ -664,7 +664,7 @@ impl Account {
); );
} }
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
{ if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
match crate::sqlite3::remove(old_hash).map(|_| { match crate::sqlite3::remove(old_hash).map(|_| {
crate::sqlite3::insert( crate::sqlite3::insert(
(*envelope).clone(), (*envelope).clone(),
@ -722,7 +722,7 @@ impl Account {
entry.set_flags(flags); entry.set_flags(flags);
}); });
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
{ if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
match crate::sqlite3::remove(env_hash).map(|_| { match crate::sqlite3::remove(env_hash).map(|_| {
crate::sqlite3::insert( crate::sqlite3::insert(
self.collection.envelopes.read().unwrap()[&env_hash].clone(), self.collection.envelopes.read().unwrap()[&env_hash].clone(),
@ -771,7 +771,7 @@ impl Account {
return Some(EnvelopeRename(old_hash, new_hash)); return Some(EnvelopeRename(old_hash, new_hash));
} }
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
{ if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
match crate::sqlite3::remove(old_hash).map(|_| { match crate::sqlite3::remove(old_hash).map(|_| {
crate::sqlite3::insert( crate::sqlite3::insert(
self.collection.envelopes.read().unwrap()[&new_hash].clone(), self.collection.envelopes.read().unwrap()[&new_hash].clone(),
@ -832,7 +832,7 @@ impl Account {
) )
}; };
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
{ if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
let (channel, handle, job_id) = let (channel, handle, job_id) =
self.job_executor.spawn_blocking(crate::sqlite3::insert( self.job_executor.spawn_blocking(crate::sqlite3::insert(
(*envelope).clone(), (*envelope).clone(),
@ -909,10 +909,10 @@ impl Account {
) )
}; };
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
{ if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
let envelopes = self.collection.envelopes.read();
let envelopes = envelopes.unwrap();
if let Err(err) = crate::sqlite3::remove(env_hash) { if let Err(err) = crate::sqlite3::remove(env_hash) {
let envelopes = self.collection.envelopes.read();
let envelopes = envelopes.unwrap();
melib::log( melib::log(
format!( format!(
"Failed to remove envelope {} [{}] in cache: {}", "Failed to remove envelope {} [{}] in cache: {}",