Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jrconlin authored Dec 4, 2024
2 parents ae1d5f5 + 7f7cfb7 commit 232f982
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 50 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

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

51 changes: 25 additions & 26 deletions syncserver/src/web/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,33 @@ pub async fn get_collections(
request: HttpRequest,
state: Data<ServerState>,
) -> Result<HttpResponse, ApiError> {
if state.glean_enabled {
// Values below are be passed to the Glean logic to emit metrics.
// This is used to measure DAU (Daily Active Use) of Sync.
let user_agent = request
.headers()
.get(header::USER_AGENT)
.and_then(|header| header.to_str().ok())
.unwrap_or("");
let device_info: DeviceInfo = get_device_info(user_agent);

state.glean_logger.record_events_ping(
&RequestInfo {
user_agent: user_agent.to_owned(),
ip_address: "".to_owned(),
},
&EventsPing {
syncstorage_device_family: device_info.device_family.to_string(),
syncstorage_hashed_device_id: meta.user_id.hashed_device_id.clone(),
syncstorage_hashed_fxa_uid: meta.user_id.hashed_fxa_uid.clone(),
syncstorage_platform: device_info.platform.to_string(),
event: Some(Box::new(SyncstorageGetCollectionsEvent {})),
},
);
}

db_pool
.transaction_http(request, |db| async move {
.transaction_http(request.clone(), |db| async move {
meta.emit_api_metric("request.get_collections");
if state.glean_enabled {
// Values below are be passed to the Glean logic to emit metrics.
// This is used to measure DAU (Daily Active Use) of Sync.
let user_agent = request
.headers()
.get(header::USER_AGENT)
.and_then(|header| header.to_str().ok())
.unwrap_or("");
let device_info: DeviceInfo = get_device_info(user_agent);

state.glean_logger.record_events_ping(
&RequestInfo {
user_agent: user_agent.to_owned(),
ip_address: "".to_owned(),
},
&EventsPing {
syncstorage_device_family: device_info.device_family.to_string(),
syncstorage_hashed_device_id: meta.user_id.hashed_device_id.clone(),
syncstorage_hashed_fxa_uid: meta.user_id.hashed_fxa_uid.clone(),
syncstorage_platform: device_info.platform.to_string(),
event: Some(Box::new(SyncstorageGetCollectionsEvent {})),
},
);
}
let result = db.get_collection_timestamps(meta.user_id).await?;

Ok(HttpResponse::build(StatusCode::OK)
Expand Down
2 changes: 1 addition & 1 deletion syncstorage-db-common/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{convert::TryInto, u64};
use std::convert::TryInto;

use chrono::{
offset::{FixedOffset, TimeZone, Utc},
Expand Down
6 changes: 1 addition & 5 deletions syncstorage-spanner/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1292,11 +1292,7 @@ impl SpannerDb {
// most databases) so we specify a max value with offset subtracted
// to avoid overflow errors (that only occur w/ a FORCE_INDEX=
// directive) OutOfRange: 400 int64 overflow: <INT64_MAX> + offset
query = format!(
"{} LIMIT {}",
query,
i64::max_value() - offset.offset as i64
);
query = format!("{} LIMIT {}", query, i64::MAX - offset.offset as i64);
};

if let Some(offset) = params.offset {
Expand Down
2 changes: 1 addition & 1 deletion tokenserver-auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ syncserver-common = { path = "../syncserver-common" }
tokenserver-common = { path = "../tokenserver-common" }
tokenserver-settings = { path = "../tokenserver-settings" }
tokio = { workspace = true }
pyo3 = { version = "0.21", features = ["auto-initialize"], optional = true }
pyo3 = { version = "0.22", features = ["auto-initialize"], optional = true }


[dev-dependencies]
Expand Down
5 changes: 2 additions & 3 deletions tokenserver-auth/src/oauth/py.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ use std::{sync::Arc, time::Duration};
/// The verifier used to verify OAuth tokens.
#[derive(Clone)]
pub struct Verifier {
// Note that we do not need to use an Arc here, since Py is already a reference-counted
// pointer
inner: Py<PyAny>,
inner: Arc<Py<PyAny>>,
timeout: u64,
blocking_threadpool: Arc<BlockingThreadpool>,
}
Expand Down Expand Up @@ -103,7 +102,7 @@ impl Verifier {
})?;

Ok(Self {
inner,
inner: Arc::new(inner),
timeout: settings.fxa_oauth_request_timeout,
blocking_threadpool,
})
Expand Down

0 comments on commit 232f982

Please sign in to comment.