Don't forget to commit after R/W operations
continuous-integration/drone the build failed Details

This commit is contained in:
Olivier 'reivilibre' 2022-03-20 22:01:57 +00:00
parent f6efc7a4e5
commit 120702ce0e
3 changed files with 18 additions and 3 deletions

View File

@ -283,5 +283,6 @@ async fn import_and_flush_batch(
} }
} }
} }
txn.commit()?;
Ok(()) Ok(())
} }

View File

@ -144,7 +144,9 @@ impl TaskContext {
} }
// TODO delete the domain from the store // TODO delete the domain from the store
todo!();
txn.commit()?;
Ok(true) Ok(true)
}) })
.await?; .await?;
@ -227,6 +229,7 @@ impl TaskContext {
self.store self.store
.async_rw_txn(move |txn| { .async_rw_txn(move |txn| {
txn.mark_url_as_visited(&domain, &url_str, record)?; txn.mark_url_as_visited(&domain, &url_str, record)?;
txn.commit()?;
Ok(()) Ok(())
}) })
.await?; .await?;
@ -266,6 +269,7 @@ impl TaskContext {
backoff_sec: 0, backoff_sec: 0,
}, },
)?; )?;
txn.commit()?;
Ok(()) Ok(())
}) })
.await?; .await?;
@ -374,7 +378,7 @@ impl TaskContext {
self.store self.store
.async_rw_txn(move |txn| { .async_rw_txn(move |txn| {
txn.start_backing_off(&domain, new_backoff, url.to_string(), failure)?; txn.start_backing_off(&domain, new_backoff, url.to_string(), failure)?;
txn.commit()?;
Ok(()) Ok(())
}) })
.await?; .await?;
@ -425,7 +429,9 @@ impl EventProcessor<'_> {
UrlVisitedRecord { UrlVisitedRecord {
last_visited_days: datestamp, last_visited_days: datestamp,
}, },
) )?;
txn.commit()?;
Ok(())
}) })
.await .await
} }
@ -453,6 +459,7 @@ impl EventProcessor<'_> {
txn.enqueue_url(&reference.target, reference.last_mod, reference.kind.into())?; txn.enqueue_url(&reference.target, reference.last_mod, reference.kind.into())?;
} }
txn.commit()?;
Ok(()) Ok(())
}) })
.await .await
@ -469,7 +476,9 @@ impl EventProcessor<'_> {
UrlVisitedRecord { UrlVisitedRecord {
last_visited_days: datestamp, last_visited_days: datestamp,
}, },
) )?;
txn.commit()?;
Ok(())
}) })
.await .await
} }

View File

@ -220,6 +220,11 @@ pub struct RakerTxn<'a, K: TransactionKind> {
} }
impl<'a> RakerTxn<'a, RW> { impl<'a> RakerTxn<'a, RW> {
pub fn commit(self) -> anyhow::Result<()> {
self.mdbx_txn.commit()?;
Ok(())
}
/// Inserts a domain into the active domain table, /// Inserts a domain into the active domain table,
/// generating a raffle ticket (and inserting it too). /// generating a raffle ticket (and inserting it too).
/// ///