Skip to content

Commit

Permalink
remove expired ones
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacherr committed Oct 21, 2024
1 parent 0126d9f commit ff74c01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assyst-core/src/task/tasks/refresh_entitlements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pub async fn refresh_entitlements(assyst: ThreadSafeAssyst) {
},
};

if active.expired() {
break;
}

if let Err(e) = active.set(&assyst.database_handler).await {
err!("Error adding new entitlement for ID {}: {e:?}", active.entitlement_id);
};
Expand All @@ -57,6 +61,7 @@ pub async fn refresh_entitlements(assyst: ThreadSafeAssyst) {
if !additional
.iter()
.any(|x| x.id.get() as i64 == entitlement.entitlement_id)
|| entitlement.expired()
{
assyst.entitlements.lock().unwrap().remove(&entitlement.entitlement_id);
info!(
Expand Down

0 comments on commit ff74c01

Please sign in to comment.