Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmittag committed Apr 23, 2024
1 parent a8d4101 commit 5ed8372
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
22 changes: 15 additions & 7 deletions databroker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3106,7 +3106,7 @@ mod tests {
)
.await
.expect("Register datapoint should succeed");

let id2 = broker
.add_entry(
"test.datapoint2".to_owned(),
Expand All @@ -3120,9 +3120,11 @@ mod tests {
.await
.expect("Register datapoint should succeed");


let mut stream = broker
.subscribe(HashMap::from([(id1, HashSet::from([Field::Datapoint]))]), None)
.subscribe(
HashMap::from([(id1, HashSet::from([Field::Datapoint]))]),
None,
)
.await
.expect("subscription should succeed");

Expand Down Expand Up @@ -3184,7 +3186,10 @@ mod tests {
}

let mut continous_stream = broker
.subscribe(HashMap::from([(id2, HashSet::from([Field::Datapoint]))]), Some(1000))
.subscribe(
HashMap::from([(id2, HashSet::from([Field::Datapoint]))]),
Some(1000),
)
.await
.expect("subscription should succeed");

Expand Down Expand Up @@ -3226,10 +3231,10 @@ mod tests {
)])
.await
.expect("setting datapoint #1");

// await next event to start the timer right
match continous_stream.next().await {
Some(next) => {
Some(next) => {
assert_eq!(next.updates.len(), 1);
assert_eq!(
next.updates[0].update.path,
Expand All @@ -3249,7 +3254,10 @@ mod tests {
match continous_stream.next().await {
Some(next) => {
// some delay is expected so check if its small enough
assert!(time.elapsed().unwrap() - Duration::from_millis(1000) < Duration::from_millis(20));
assert!(
time.elapsed().unwrap() - Duration::from_millis(1000)
< Duration::from_millis(20)
);
assert_eq!(next.updates.len(), 1);
assert_eq!(
next.updates[0].update.path,
Expand Down
5 changes: 1 addition & 4 deletions databroker/src/grpc/kuksa_val_v1/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,7 @@ impl proto::val_server::Val for broker::DataBroker {
}
}

match broker
.subscribe(entries, request.interval_ms)
.await
{
match broker.subscribe(entries, request.interval_ms).await {
Ok(stream) => {
let stream = convert_to_proto_stream(stream);
Ok(tonic::Response::new(Box::pin(stream)))
Expand Down

0 comments on commit 5ed8372

Please sign in to comment.