File tree 4 files changed +15
-0
lines changed
common/credential-storage/src
4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ impl SqliteEcashTicketbookManager {
23
23
SqliteEcashTicketbookManager { connection_pool }
24
24
}
25
25
26
+ /// Closes the connection pool.
27
+ pub async fn close ( & self ) {
28
+ self . connection_pool . close ( ) . await
29
+ }
30
+
26
31
pub ( crate ) async fn cleanup_expired ( & self , deadline : Date ) -> Result < ( ) , sqlx:: Error > {
27
32
sqlx:: query!(
28
33
"DELETE FROM ecash_ticketbook WHERE expiration_date <= ?" ,
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ impl Debug for EphemeralStorage {
43
43
impl Storage for EphemeralStorage {
44
44
type StorageError = StorageError ;
45
45
46
+ async fn close ( & self ) {
47
+ // nothing to do here
48
+ }
49
+
46
50
async fn cleanup_expired ( & self ) -> Result < ( ) , Self :: StorageError > {
47
51
self . storage_manager . cleanup_expired ( ) . await ;
48
52
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ impl PersistentStorage {
89
89
impl Storage for PersistentStorage {
90
90
type StorageError = StorageError ;
91
91
92
+ async fn close ( & self ) {
93
+ self . storage_manager . close ( ) . await
94
+ }
95
+
92
96
/// remove all expired ticketbooks and expiration date signatures
93
97
async fn cleanup_expired ( & self ) -> Result < ( ) , Self :: StorageError > {
94
98
let ecash_yesterday = ecash_today ( ) . date ( ) . previous_day ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ use std::error::Error;
22
22
pub trait Storage : Send + Sync {
23
23
type StorageError : Error ;
24
24
25
+ async fn close ( & self ) ;
26
+
25
27
/// remove all expired ticketbooks and expiration date signatures
26
28
async fn cleanup_expired ( & self ) -> Result < ( ) , Self :: StorageError > ;
27
29
You can’t perform that action at this time.
0 commit comments