Skip to content

Commit

Permalink
Expire sessions on remote after 7 inactive days
Browse files Browse the repository at this point in the history
  • Loading branch information
ostenbom committed May 8, 2023
1 parent 2b9352d commit f3a9798
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion worker/src/kv_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ impl StringStore for CfWorkerStringStore {
}

async fn put(&self, key: String, value: String) -> Result<(), SessionError> {
let put = match self.kv.put(&key, value) {
let mut put = match self.kv.put(&key, value) {
Ok(p) => p,
Err(e) => return Err(SessionError::PutError(e.to_string())),
};

// Default to expiring sessions after 7 days of inactivity
put = put.expiration_ttl(60 * 60 * 24 * 7);

put.execute()
.await
.map_err(|e| SessionError::PutError(e.to_string()))
Expand Down

0 comments on commit f3a9798

Please sign in to comment.