fix: only use cached potokens with min. 10min lifetime

This commit is contained in:
ThetaDev 2025-02-07 22:00:48 +01:00
parent a80f046a19
commit 0c94267d03
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
2 changed files with 49 additions and 17 deletions

View file

@ -181,7 +181,7 @@ impl VisitorDataCache {
pub fn get_pot(&self, visitor_data: &str) -> Option<PoToken> {
let pots = self.inner.session_potoken.read().unwrap();
if let Some(entry) = pots.get(visitor_data) {
if entry.valid_until > OffsetDateTime::now_utc() {
if entry.valid_until > OffsetDateTime::now_utc() + time::Duration::minutes(10) {
return Some(entry.clone());
}
}