Skip to content

Commit

Permalink
update a bunch of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lthiery committed Jan 22, 2024
1 parent b1aba11 commit a0181b0
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 30 deletions.
158 changes: 137 additions & 21 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ edition = "2021"

[dependencies]
anchor-lang = "*"
axum = { version = "0.6", features = ["query"] }
axum = { version = "0.7", features = ["query"] }
axum-server = { version = "0" }
base64 = ">=0.20"
bs58 = "0"
chrono = "0"
Expand Down
2 changes: 1 addition & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl Server {
result = positions::get_positions(rpc_client.clone(), positions_memory,
epoch_info_memory.clone()) => result,
result = epoch_info::get_epoch_info(rpc_client, epoch_info_memory) => result,
result = axum::Server::bind(&addr)
result = axum_server::bind(addr)
.serve(app.into_make_service()) =>
result.map_err(|e| Error::Axum(e.into())),
)
Expand Down
1 change: 0 additions & 1 deletion src/server/positions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub use crate::cli::positions::{AllPositionsData, LockupType, Position, Position
use crate::types::SubDao;
use anchor_lang::solana_program::pubkey::Pubkey;
use axum::{
body::{self, Empty, Full},
extract::Path,
http::{header, HeaderValue},
response::{IntoResponse, Response},
Expand Down
13 changes: 7 additions & 6 deletions src/server/positions/serve_csv.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::*;
use axum::body::{Body, Bytes};

pub async fn server_latest_delegated_positions_as_csv(
Extension(memory): Extension<Arc<Mutex<Option<Memory>>>>,
Expand All @@ -17,14 +18,14 @@ pub async fn server_latest_delegated_positions_as_csv(
match File::open(&latest_file).await {
Err(_) => Ok(Response::builder()
.status(StatusCode::NOT_FOUND)
.body(body::boxed(Empty::new()))
.body(Body::empty())
.unwrap()),
Ok(mut file) => {
let mut contents = vec![];
match file.read_to_end(&mut contents).await {
Err(_) => Ok(Response::builder()
.status(StatusCode::NOT_FOUND)
.body(body::boxed(Empty::new()))
.body(Body::empty())
.unwrap()),
Ok(_) => {
drop(memory_mutex);
Expand All @@ -41,7 +42,7 @@ pub async fn server_latest_delegated_positions_as_csv(
))
.unwrap(),
)
.body(body::boxed(Full::from(contents)))
.body(Body::from(Bytes::from(contents)))
.unwrap())
}
}
Expand All @@ -66,14 +67,14 @@ pub async fn server_latest_positions_as_csv(
match File::open(&latest_file).await {
Err(_) => Ok(Response::builder()
.status(StatusCode::NOT_FOUND)
.body(body::boxed(Empty::new()))
.body(Body::empty())
.unwrap()),
Ok(mut file) => {
let mut contents = vec![];
match file.read_to_end(&mut contents).await {
Err(_) => Ok(Response::builder()
.status(StatusCode::NOT_FOUND)
.body(body::boxed(Empty::new()))
.body(Body::empty())
.unwrap()),
Ok(_) => {
drop(memory_mutex);
Expand All @@ -90,7 +91,7 @@ pub async fn server_latest_positions_as_csv(
))
.unwrap(),
)
.body(body::boxed(Full::from(contents)))
.body(Body::from(Bytes::from(contents)))
.unwrap())
}
}
Expand Down

0 comments on commit a0181b0

Please sign in to comment.