Skip to content
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

fix: don't emit a content-type header for 304s #1526

Merged
merged 1 commit into from
Feb 29, 2024
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 syncserver/src/web/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ pub async fn lbheartbeat(req: HttpRequest) -> Result<HttpResponse, ApiError> {
Some(s) => s,
None => {
error!("⚠️ Could not load the app state");
return Ok(HttpResponse::InternalServerError().body(""));
return Ok(HttpResponse::InternalServerError().finish());
}
};

Expand Down
3 changes: 1 addition & 2 deletions syncserver/src/web/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ impl DbTransactionPool {
};
if status != StatusCode::OK {
return Ok(HttpResponse::build(status)
.content_type("application/json")
.insert_header((X_LAST_MODIFIED, resource_ts.as_header()))
.body("".to_owned()));
.finish());
};
}

Expand Down
39 changes: 0 additions & 39 deletions syncstorage-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ pub mod mock;
#[cfg(test)]
mod tests;

use std::time::Duration;

use cadence::{Gauged, StatsdClient};
use tokio::{self, time};

#[cfg(feature = "mysql")]
pub type DbPoolImpl = syncstorage_mysql::MysqlDbPool;
#[cfg(feature = "mysql")]
Expand Down Expand Up @@ -41,37 +36,3 @@ compile_error!("only one of the \"mysql\" and \"spanner\" features can be enable

#[cfg(not(any(feature = "mysql", feature = "spanner")))]
compile_error!("exactly one of the \"mysql\" and \"spanner\" features must be enabled");

/// Emit DbPool metrics periodically
pub fn spawn_pool_periodic_reporter<T: GetPoolState + Send + 'static>(
interval: Duration,
metrics: StatsdClient,
pool: T,
) -> Result<(), DbError> {
let hostname = hostname::get()
.expect("Couldn't get hostname")
.into_string()
.expect("Couldn't get hostname");
tokio::spawn(async move {
loop {
let PoolState {
connections,
idle_connections,
} = pool.state();
metrics
.gauge_with_tags(
"storage.pool.connections.active",
(connections - idle_connections) as u64,
)
.with_tag("hostname", &hostname)
.send();
metrics
.gauge_with_tags("storage.pool.connections.idle", idle_connections as u64)
.with_tag("hostname", &hostname)
.send();
time::sleep(interval).await;
}
});

Ok(())
}