Skip to content

Commit

Permalink
PR requested updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Quinn committed Dec 28, 2024
1 parent bc32827 commit 67ed8d7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# IDE stuff
.idea/
.vscode/

# Allow developers to use python pre-commit locally
/.pre-commit-config.yaml
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion relay-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ publish = false
[dependencies]
clap = { version = "4", features = ["derive"] }
eyre.workspace = true
json5 = "0.4"
orb-relay-messages.workspace = true
orb-security-utils = { workspace = true, features = ["reqwest"] }
rand = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion relay-client/src/bin/decode-msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() -> Result<()> {

fn decode_payload(json: &str) -> Result<String> {
println!("json: {}", json);
let v: Value = json5::from_str(json)?;
let v: Value = serde_json::from_str(json)?;
let any = Any {
type_url: v["type_url"]
.as_str()
Expand Down
26 changes: 12 additions & 14 deletions relay-client/src/bin/manual-test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

use clap::Parser;
use eyre::{Ok, Result};
use orb_relay_client::{client::Client, debug_any, PayloadMatcher};
Expand Down Expand Up @@ -120,7 +118,7 @@ async fn app_to_orb() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in orb_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -160,7 +158,7 @@ async fn app_to_orb() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in orb_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -234,7 +232,7 @@ async fn orb_to_app() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -274,7 +272,7 @@ async fn orb_to_app() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -342,7 +340,7 @@ async fn orb_to_app_with_state_request() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -376,7 +374,7 @@ async fn orb_to_app_with_state_request() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -404,7 +402,7 @@ async fn orb_to_app_with_state_request() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -476,7 +474,7 @@ async fn orb_to_app_blocking_send() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -519,7 +517,7 @@ async fn orb_to_app_blocking_send() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -595,7 +593,7 @@ async fn orb_to_app_with_clients_created_later_and_delay() -> Result<()> {

let now = Instant::now();
'ext: loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -657,7 +655,7 @@ async fn stage_consumer_app() -> Result<()> {
tracing::info!("Time took to connect: {}ms", now.elapsed().as_millis());

loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down Expand Up @@ -715,7 +713,7 @@ async fn stage_producer_from_app_start_orb_signup() -> Result<()> {
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;

loop {
#[allow(clippy::never_loop)]
#[expect(clippy::never_loop)]
for msg in app_client.get_buffered_messages().await {
tracing::info!(
"Received message: from: {:?}, to: {:?}, seq: {:?}, payload: {:?}",
Expand Down
1 change: 1 addition & 0 deletions relay-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ impl<'a> PollerAgent<'a> {
Ok((response_stream, sender_tx))
}

// TODO: See if we can move this setup into `orb-security-utils`.
fn create_tls_config() -> ClientTlsConfig {
ClientTlsConfig::new().ca_certificates(vec![
Certificate::from_pem(AWS_ROOT_CA1_CERT),
Expand Down
2 changes: 0 additions & 2 deletions relay-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use orb_relay_messages::{common, prost::Name, prost_types::Any, self_serve};

pub mod client;

#[allow(missing_docs)]
pub trait PayloadMatcher {
type Output;
fn matches(payload: &Any) -> Option<Self::Output>;
Expand Down Expand Up @@ -67,7 +66,6 @@ impl PayloadMatcher for self_serve::orb::v1::SignupEnded {
}
}

#[allow(missing_docs)]
pub trait IntoPayload {
fn into_payload(self) -> Any;
}
Expand Down

0 comments on commit 67ed8d7

Please sign in to comment.