Skip to content

Commit

Permalink
gzip
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyKitten committed Dec 2, 2024
1 parent f08f7f7 commit 1f98738
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
37 changes: 36 additions & 1 deletion 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 stationapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sqlx = { version = "0.7", features = [
"mysql",
] }
tokio = { version = "1.28.0", features = ["full"] }
tonic = "0.10.1"
tonic = { version = "0.10.1", features = ["gzip"] }
tonic-web = "0.10.1"
tracing = "0.1.37"
tracing-subscriber = "0.3.17"
Expand Down
5 changes: 4 additions & 1 deletion stationapi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::{
env::{self, VarError},
net::{AddrParseError, SocketAddr},
};
use tonic::codec::CompressionEncoding;
use tonic::transport::Server;
use tonic_health::server::HealthReporter;
use tracing::{info, warn};
Expand Down Expand Up @@ -72,7 +73,9 @@ async fn run() -> std::result::Result<(), anyhow::Error> {

let my_api = MyApi { query_use_case };

let svc = StationApiServer::new(my_api);
let svc = StationApiServer::new(my_api)
.send_compressed(CompressionEncoding::Gzip)
.accept_compressed(CompressionEncoding::Gzip);

info!("StationAPI Server listening on {}", addr);

Expand Down

0 comments on commit 1f98738

Please sign in to comment.