Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions common/credential-storage/src/backends/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion common/credential-storage/src/persistent_storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down
Loading