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

Log a warning for slow signal updates to subscribers #116

Draft
wants to merge 5 commits into
base: 0.5.X
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/workflows/kuksa_databroker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ on:
QUAY_IO_USERNAME:
required: true
workflow_dispatch:
# Run every Sunday night to check regressions, for example from clippy
schedule:
- cron: "0 4 * * 0"

# suffix to avoid cancellation when running from release workflow
concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ __pycache__
databroker/thirdparty
databroker-cli/thirdparty
.venv/
databroker/databroker_bin.cdx.json
databroker-cli/databroker-cli_bin.cdx.json
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion databroker-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

[package]
name = "databroker-cli"
version = "0.5.0"
version = "0.5.0-dev.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better with "0.5.1-dev.1" (or "0.5.1-dev.0") as it is not a pre-release to 0.5.0 but rather a possible pre-release to an upcoming 0.5.1

https://github.com/eclipse-kuksa/kuksa-databroker/wiki/Release-Process#proposed-versioning-scheme

authors = ["Eclipse KUKSA Project"]
edition = "2021"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion databroker-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

[package]
name = "databroker-proto"
version = "0.5.0"
version = "0.5.0-dev.1"
authors = ["Eclipse KUKSA Project"]
edition = "2021"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion databroker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

[package]
name = "databroker"
version = "0.5.0"
version = "0.5.0-dev.1"
authors = ["Eclipse KUKSA Project"]
edition = "2021"
license = "Apache-2.0"
Expand Down
17 changes: 10 additions & 7 deletions databroker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ pub enum EntryReadAccess<'a> {
Err(&'a Metadata, ReadError),
}

impl<'a> EntryReadAccess<'a> {
impl EntryReadAccess<'_> {
pub fn datapoint(&self) -> Result<&Datapoint, ReadError> {
match self {
Self::Entry(entry) => Ok(&entry.datapoint),
Expand Down Expand Up @@ -1151,7 +1151,7 @@ pub struct EntryReadIterator<'a, 'b> {
permissions: &'b Permissions,
}

impl<'a, 'b> Iterator for EntryReadIterator<'a, 'b> {
impl<'a> Iterator for EntryReadIterator<'a, '_> {
type Item = EntryReadAccess<'a>;

#[inline]
Expand All @@ -1167,7 +1167,7 @@ impl<'a, 'b> Iterator for EntryReadIterator<'a, 'b> {
}
}

impl<'a, 'b> DatabaseReadAccess<'a, 'b> {
impl DatabaseReadAccess<'_, '_> {
pub fn get_entry_by_id(&self, id: i32) -> Result<&Entry, ReadError> {
match self.db.entries.get(&id) {
Some(entry) => match self.permissions.can_read(&entry.metadata.path) {
Expand Down Expand Up @@ -1203,7 +1203,7 @@ impl<'a, 'b> DatabaseReadAccess<'a, 'b> {
}
}

impl<'a, 'b> DatabaseWriteAccess<'a, 'b> {
impl DatabaseWriteAccess<'_, '_> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you changed from explicit lifetimes to anonymous lifetimes? did it complain?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inherited from #114, see also https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

As we use "latest and greatest" clippy we get these types of regressions now and then

(long term we could discuss if we rather should have a fixed rust/clippy/fmt version and perform updates only when preparing for a (major) release, to reduce the risk of regressions)

pub fn update_by_path(
&mut self,
path: &str,
Expand Down Expand Up @@ -1397,7 +1397,7 @@ impl Database {
}
}

impl<'a, 'b> query::CompilationInput for DatabaseReadAccess<'a, 'b> {
impl query::CompilationInput for DatabaseReadAccess<'_, '_> {
fn get_datapoint_type(&self, path: &str) -> Result<DataType, query::CompilationError> {
match self.get_metadata_by_path(path) {
Some(metadata) => Ok(metadata.data_type.to_owned()),
Expand Down Expand Up @@ -1670,10 +1670,13 @@ impl<'a, 'b> AuthorizedAccess<'a, 'b> {
.await
.add_change_subscription(subscription);

let stream = BroadcastStream::new(receiver).filter_map(|result| match result {
let stream = BroadcastStream::new(receiver).filter_map(move |result| match result {
Ok(message) => Some(message),
Err(err) => {
debug!("Lagged entries: {}", err);
warn!(
"Slow subscriber with capacity {} lagged and missed signal updates: {}",
channel_capacity, err
);
None
}
});
Expand Down
96 changes: 86 additions & 10 deletions lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ resolver = "2"
members = [
"common",
"kuksa",
"sdv"
"sdv",
"databroker-examples"
]

[workspace.dependencies]
Expand Down
Loading