@@ -111,7 +111,7 @@ pub(crate) type SessionState = HashMap<String, String>;
111
111
impl SessionStore for SqlxPostgresqlSessionStore {
112
112
async fn load ( & self , session_key : & SessionKey ) -> Result < Option < SessionState > , LoadError > {
113
113
let key = ( self . configuration . cache_keygen ) ( session_key. as_ref ( ) ) ;
114
- let row = sqlx:: query ( "SELECT session_state FROM sessions WHERE key = $1 AND expiry > NOW()" )
114
+ let row = sqlx:: query ( "SELECT session_state FROM sessions WHERE key = $1 AND expires > NOW()" )
115
115
. bind ( key)
116
116
. fetch_optional ( & self . client_pool )
117
117
. await
@@ -133,11 +133,11 @@ impl SessionStore for SqlxPostgresqlSessionStore {
133
133
. map_err ( SaveError :: Serialization ) ?;
134
134
let key = generate_session_key ( ) ;
135
135
let cache_key = ( self . configuration . cache_keygen ) ( key. as_ref ( ) ) ;
136
- let expiry = Utc :: now ( ) + chrono:: Duration :: seconds ( ttl. whole_seconds ( ) as i64 ) ;
137
- sqlx:: query ( "INSERT INTO sessions(key, value, expiry ) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING" )
136
+ let expires = Utc :: now ( ) + chrono:: Duration :: seconds ( ttl. whole_seconds ( ) as i64 ) ;
137
+ sqlx:: query ( "INSERT INTO sessions(key, session_state, expires ) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING" )
138
138
. bind ( cache_key)
139
139
. bind ( body)
140
- . bind ( expiry )
140
+ . bind ( expires )
141
141
. execute ( & self . client_pool )
142
142
. await
143
143
. map_err ( Into :: into)
@@ -148,10 +148,10 @@ impl SessionStore for SqlxPostgresqlSessionStore {
148
148
async fn update ( & self , session_key : SessionKey , session_state : SessionState , ttl : & Duration ) -> Result < SessionKey , UpdateError > {
149
149
let body = serde_json:: to_string ( & session_state) . map_err ( Into :: into) . map_err ( UpdateError :: Serialization ) ?;
150
150
let cache_key = ( self . configuration . cache_keygen ) ( session_key. as_ref ( ) ) ;
151
- let new_expiry = Utc :: now ( ) + chrono:: Duration :: seconds ( ttl. whole_seconds ( ) ) ;
152
- sqlx:: query ( "UPDATE sessions SET value = $1, expiry = $2 WHERE key = $3" )
151
+ let new_expires = Utc :: now ( ) + chrono:: Duration :: seconds ( ttl. whole_seconds ( ) ) ;
152
+ sqlx:: query ( "UPDATE sessions SET session_state = $1, expires = $2 WHERE key = $3" )
153
153
. bind ( body)
154
- . bind ( new_expiry )
154
+ . bind ( new_expires )
155
155
. bind ( cache_key)
156
156
. execute ( & self . client_pool )
157
157
. await
@@ -161,10 +161,10 @@ impl SessionStore for SqlxPostgresqlSessionStore {
161
161
}
162
162
163
163
async fn update_ttl ( & self , session_key : & SessionKey , ttl : & Duration ) -> Result < ( ) , anyhow:: Error > {
164
- let new_expiry = Utc :: now ( ) + chrono:: Duration :: seconds ( ttl. whole_seconds ( ) as i64 ) ;
164
+ let new_expires = Utc :: now ( ) + chrono:: Duration :: seconds ( ttl. whole_seconds ( ) as i64 ) ;
165
165
let key = ( self . configuration . cache_keygen ) ( session_key. as_ref ( ) ) ;
166
- sqlx:: query ( "UPDATE sessions SET expiry = $1 WHERE key = $2" )
167
- . bind ( new_expiry )
166
+ sqlx:: query ( "UPDATE sessions SET expires = $1 WHERE key = $2" )
167
+ . bind ( new_expires )
168
168
. bind ( key)
169
169
. execute ( & self . client_pool )
170
170
. await
0 commit comments