Skip to content

Commit f8e26c0

Browse files
authored
Merge branch 'dev' into validator-messages
2 parents f98c8ba + 1003e75 commit f8e26c0

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
@@ -176,19 +176,17 @@ mod list_channels {
176176
pool: &DbPool,
177177
(where_clauses, params): (&'a [String], Vec<&'a (dyn ToSql + Sync)>),
178178
) -> Result<u64, RunError<bb8_postgres::tokio_postgres::Error>> {
179-
pool.run(move |connection| {
180-
async move {
181-
let statement = format!(
182-
"SELECT COUNT(id)::varchar FROM channels WHERE {}",
183-
where_clauses.join(" AND ")
184-
);
185-
match connection.prepare(&statement).await {
186-
Ok(stmt) => match connection.query_one(&stmt, params.as_slice()).await {
187-
Ok(row) => Ok((row.get::<_, TotalCount>(0).0, connection)),
188-
Err(e) => Err((e, connection)),
189-
},
179+
pool.run(move |connection| async move {
180+
let statement = format!(
181+
"SELECT COUNT(id)::varchar FROM channels WHERE {}",
182+
where_clauses.join(" AND ")
183+
);
184+
match connection.prepare(&statement).await {
185+
Ok(stmt) => match connection.query_one(&stmt, params.as_slice()).await {
186+
Ok(row) => Ok((row.get::<_, TotalCount>(0).0, connection)),
190187
Err(e) => Err((e, connection)),
191-
}
188+
},
189+
Err(e) => Err((e, connection)),
192190
}
193191
})
194192
.await

0 commit comments

Comments
 (0)