Skip to content

Commit c3258d5

Browse files
fix(hermes): make ignore_invalid_price_ids param optional on the SSE stream API (#2102)
1 parent d3cc7df commit c3258d5

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

apps/hermes/server/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/hermes/server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hermes"
3-
version = "0.7.0"
3+
version = "0.7.1"
44
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
55
edition = "2021"
66

apps/hermes/server/src/api/rest/v2/sse.rs

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,27 @@
11
use {
22
crate::{
33
api::{
4-
rest::{
5-
validate_price_ids,
6-
RestError,
7-
},
4+
rest::{validate_price_ids, RestError},
85
types::{
9-
BinaryUpdate,
10-
EncodingType,
11-
ParsedPriceUpdate,
12-
PriceIdInput,
13-
PriceUpdate,
6+
BinaryUpdate, EncodingType, ParsedPriceUpdate, PriceIdInput, PriceUpdate,
147
RpcPriceIdentifier,
158
},
169
ApiState,
1710
},
18-
state::aggregate::{
19-
Aggregates,
20-
AggregationEvent,
21-
RequestTime,
22-
},
11+
state::aggregate::{Aggregates, AggregationEvent, RequestTime},
2312
},
2413
anyhow::Result,
2514
axum::{
2615
extract::State,
27-
response::sse::{
28-
Event,
29-
KeepAlive,
30-
Sse,
31-
},
16+
response::sse::{Event, KeepAlive, Sse},
3217
},
3318
futures::Stream,
3419
pyth_sdk::PriceIdentifier,
3520
serde::Deserialize,
3621
serde_qs::axum::QsQuery,
3722
std::convert::Infallible,
3823
tokio::sync::broadcast,
39-
tokio_stream::{
40-
wrappers::BroadcastStream,
41-
StreamExt as _,
42-
},
24+
tokio_stream::{wrappers::BroadcastStream, StreamExt as _},
4325
utoipa::IntoParams,
4426
};
4527

@@ -74,7 +56,8 @@ pub struct StreamPriceUpdatesQueryParams {
7456
#[serde(default)]
7557
benchmarks_only: bool,
7658

77-
/// If true, invalid price IDs in the `ids` parameter are ignored. Only applicable to the v2 APIs. Default is `false`. #[serde(default)]
59+
/// If true, invalid price IDs in the `ids` parameter are ignored. Only applicable to the v2 APIs. Default is `false`.
60+
#[serde(default)]
7861
ignore_invalid_price_ids: bool,
7962
}
8063

@@ -179,7 +162,6 @@ where
179162
.map(|price_feed| price_feed.into())
180163
.collect();
181164

182-
183165
if benchmarks_only {
184166
// Remove those with metadata.prev_publish_time != price.publish_time from parsed_price_updates
185167
parsed_price_updates.retain(|price_feed| {

0 commit comments

Comments
 (0)