Skip to content

Commit e3b75be

Browse files
committed
sentry - access - fix test & run rustfmt
1 parent dcdf845 commit e3b75be

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed

sentry/src/access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ mod test {
260260
uids: None,
261261
rate_limit: Some(RateLimit {
262262
limit_type: "ip".to_string(),
263-
time_frame: Duration::from_millis(20_000),
263+
time_frame: Duration::from_millis(1),
264264
}),
265265
};
266266
let channel = get_channel(rule);

sentry/src/db/analytics.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,17 @@ pub async fn get_analytics(
8383
);
8484

8585
// execute query
86-
pool.run(move |connection| {
87-
async move {
88-
match connection.prepare(&sql_query).await {
89-
Ok(stmt) => match connection.query(&stmt, &[]).await {
90-
Ok(rows) => {
91-
let analytics: Vec<AnalyticsResponse> =
92-
rows.iter().map(AnalyticsResponse::from).collect();
93-
Ok((analytics, connection))
94-
}
95-
Err(e) => Err((e, connection)),
96-
},
86+
pool.run(move |connection| async move {
87+
match connection.prepare(&sql_query).await {
88+
Ok(stmt) => match connection.query(&stmt, &[]).await {
89+
Ok(rows) => {
90+
let analytics: Vec<AnalyticsResponse> =
91+
rows.iter().map(AnalyticsResponse::from).collect();
92+
Ok((analytics, connection))
93+
}
9794
Err(e) => Err((e, connection)),
98-
}
95+
},
96+
Err(e) => Err((e, connection)),
9997
}
10098
})
10199
.await

sentry/src/db/channel.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,17 @@ mod list_channels {
150150
pool: &DbPool,
151151
(where_clauses, params): (&'a [String], Vec<&'a (dyn ToSql + Sync)>),
152152
) -> Result<u64, RunError<bb8_postgres::tokio_postgres::Error>> {
153-
pool.run(move |connection| {
154-
async move {
155-
let statement = format!(
156-
"SELECT COUNT(id)::varchar FROM channels WHERE {}",
157-
where_clauses.join(" AND ")
158-
);
159-
match connection.prepare(&statement).await {
160-
Ok(stmt) => match connection.query_one(&stmt, params.as_slice()).await {
161-
Ok(row) => Ok((row.get::<_, TotalCount>(0).0, connection)),
162-
Err(e) => Err((e, connection)),
163-
},
153+
pool.run(move |connection| async move {
154+
let statement = format!(
155+
"SELECT COUNT(id)::varchar FROM channels WHERE {}",
156+
where_clauses.join(" AND ")
157+
);
158+
match connection.prepare(&statement).await {
159+
Ok(stmt) => match connection.query_one(&stmt, params.as_slice()).await {
160+
Ok(row) => Ok((row.get::<_, TotalCount>(0).0, connection)),
164161
Err(e) => Err((e, connection)),
165-
}
162+
},
163+
Err(e) => Err((e, connection)),
166164
}
167165
})
168166
.await

0 commit comments

Comments
 (0)