Merge pull request #6300 from nymtech/simon/db_lock_cherrypick
[cherrypick] fix credential db locking
This commit is contained in:
@@ -39,8 +39,11 @@ impl SqliteEcashTicketbookManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn begin_storage_tx(&self) -> Result<Transaction<'_, Sqlite>, sqlx::Error> {
|
||||
self.connection_pool.begin().await
|
||||
/// Starts a write (IMMEDIATE) transaction, to prevent issue when upgrading from a read one to a write one
|
||||
pub(crate) async fn begin_storage_write_tx(
|
||||
&self,
|
||||
) -> Result<Transaction<'_, Sqlite>, sqlx::Error> {
|
||||
self.connection_pool.begin_with("BEGIN IMMEDIATE").await
|
||||
}
|
||||
|
||||
pub(crate) async fn insert_pending_ticketbook(
|
||||
|
||||
@@ -243,7 +243,7 @@ impl Storage for PersistentStorage {
|
||||
tickets: u32,
|
||||
) -> Result<Option<RetrievedTicketbook>, Self::StorageError> {
|
||||
let deadline = ecash_today().ecash_date();
|
||||
let mut tx = self.storage_manager.begin_storage_tx().await?;
|
||||
let mut tx = self.storage_manager.begin_storage_write_tx().await?;
|
||||
|
||||
// we don't want ticketbooks with expiration in the past
|
||||
let Some(raw) =
|
||||
|
||||
Reference in New Issue
Block a user