diff --git a/databroker/src/broker.rs b/databroker/src/broker.rs index dfa61eef..180cf2d4 100644 --- a/databroker/src/broker.rs +++ b/databroker/src/broker.rs @@ -665,7 +665,17 @@ impl Subscriptions { info!("Subscriber gone: removing subscription"); false } else { - true + match &sub.permissions.expired() { + Ok(()) => true, + Err(PermissionError::Expired) => { + info!("Token expired: removing subscription"); + false + } + Err(err) => { + info!("Error: {:?} -> removing subscription", err); + false + } + } } }); } @@ -693,7 +703,6 @@ impl ChangeSubscription { // notify let notifications = { let mut notifications = EntryUpdates::default(); - for (id, changed_fields) in changed { if let Some(fields) = self.entries.get(id) { if !fields.is_disjoint(changed_fields) { @@ -723,8 +732,12 @@ impl ChangeSubscription { fields: notify_fields, }); } + Err(ReadError::PermissionExpired) => { + debug!("notify: token expired, closing subscription channel"); + return Err(NotificationError {}); + } Err(_) => { - debug!("notify: could not find entry with id {}", id) + debug!("notify: could not find entry with id {}", id); } } }