Skip to content

fix(hermes): make ignore_invalid_price_ids param optional on the stream API #2102

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

Merged
Merged
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
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
Loading