Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFO3: Close subscription after expired token #12

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions databroker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
});
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Loading