Skip to content

Commit

Permalink
fix(hermes): make ignore_invalid_price_ids param optional on the SS…
Browse files Browse the repository at this point in the history
…E stream API (#2102)
  • Loading branch information
tejasbadadare authored Nov 6, 2024
1 parent d3cc7df commit c3258d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
2 changes: 1 addition & 1 deletion apps/hermes/server/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 apps/hermes/server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hermes"
version = "0.7.0"
version = "0.7.1"
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
edition = "2021"

Expand Down
32 changes: 7 additions & 25 deletions apps/hermes/server/src/api/rest/v2/sse.rs
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
use {
crate::{
api::{
rest::{
validate_price_ids,
RestError,
},
rest::{validate_price_ids, RestError},
types::{
BinaryUpdate,
EncodingType,
ParsedPriceUpdate,
PriceIdInput,
PriceUpdate,
BinaryUpdate, EncodingType, ParsedPriceUpdate, PriceIdInput, PriceUpdate,
RpcPriceIdentifier,
},
ApiState,
},
state::aggregate::{
Aggregates,
AggregationEvent,
RequestTime,
},
state::aggregate::{Aggregates, AggregationEvent, RequestTime},
},
anyhow::Result,
axum::{
extract::State,
response::sse::{
Event,
KeepAlive,
Sse,
},
response::sse::{Event, KeepAlive, Sse},
},
futures::Stream,
pyth_sdk::PriceIdentifier,
serde::Deserialize,
serde_qs::axum::QsQuery,
std::convert::Infallible,
tokio::sync::broadcast,
tokio_stream::{
wrappers::BroadcastStream,
StreamExt as _,
},
tokio_stream::{wrappers::BroadcastStream, StreamExt as _},
utoipa::IntoParams,
};

Expand Down Expand Up @@ -74,7 +56,8 @@ pub struct StreamPriceUpdatesQueryParams {
#[serde(default)]
benchmarks_only: bool,

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

Expand Down Expand Up @@ -179,7 +162,6 @@ where
.map(|price_feed| price_feed.into())
.collect();


if benchmarks_only {
// Remove those with metadata.prev_publish_time != price.publish_time from parsed_price_updates
parsed_price_updates.retain(|price_feed| {
Expand Down

0 comments on commit c3258d5

Please sign in to comment.