File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
common/credential-storage/src Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,11 @@ impl SqliteEcashTicketbookManager {
3939 Ok ( ( ) )
4040 }
4141
42- pub ( crate ) async fn begin_storage_tx ( & self ) -> Result < Transaction < ' _ , Sqlite > , sqlx:: Error > {
43- self . connection_pool . begin ( ) . await
42+ /// Starts a write (IMMEDIATE) transaction, to prevent issue when upgrading from a read one to a write one
43+ pub ( crate ) async fn begin_storage_write_tx (
44+ & self ,
45+ ) -> Result < Transaction < ' _ , Sqlite > , sqlx:: Error > {
46+ self . connection_pool . begin_with ( "BEGIN IMMEDIATE" ) . await
4447 }
4548
4649 pub ( crate ) async fn insert_pending_ticketbook (
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ impl Storage for PersistentStorage {
243243 tickets : u32 ,
244244 ) -> Result < Option < RetrievedTicketbook > , Self :: StorageError > {
245245 let deadline = ecash_today ( ) . ecash_date ( ) ;
246- let mut tx = self . storage_manager . begin_storage_tx ( ) . await ?;
246+ let mut tx = self . storage_manager . begin_storage_write_tx ( ) . await ?;
247247
248248 // we don't want ticketbooks with expiration in the past
249249 let Some ( raw) =
You can’t perform that action at this time.
0 commit comments