Minor cleanup
This commit is contained in:
parent
c61d6e7036
commit
faed07bf7d
|
@ -1087,7 +1087,7 @@ pub async fn get_stats_for_room(
|
|||
};
|
||||
|
||||
let raw_query_posts = format!(
|
||||
"SELECT COUNT(id) FROM {} WHERE timestamp > ?1 AND timestamp <= ?2",
|
||||
"SELECT COUNT(id) FROM {} WHERE timestamp >= ?1 AND timestamp <= ?2",
|
||||
storage::MESSAGES_TABLE
|
||||
);
|
||||
|
||||
|
|
|
@ -68,9 +68,9 @@ pub fn get_url() -> impl Filter<Extract = impl warp::Reply, Error = Rejection> +
|
|||
return warp::get().and(warp::path("url")).and_then(handlers::get_url);
|
||||
}
|
||||
|
||||
/// GET /stats/:id?window=:seconds
|
||||
/// GET /stats/:room_id?window=:seconds
|
||||
///
|
||||
/// not publicly exposed
|
||||
/// Not publicly exposed
|
||||
pub fn get_room_stats() -> impl Filter<Extract = impl warp::Reply, Error = Rejection> + Clone {
|
||||
return warp::get()
|
||||
.and(warp::path!("stats" / String))
|
||||
|
|
|
@ -56,7 +56,6 @@ pub const BLOCK_LIST_TABLE: &str = "block_list";
|
|||
pub const PENDING_TOKENS_TABLE: &str = "pending_tokens";
|
||||
pub const TOKENS_TABLE: &str = "tokens";
|
||||
pub const FILES_TABLE: &str = "files";
|
||||
|
||||
pub const USER_ACTIVITY_TABLE: &str = "user_activity";
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
|
@ -158,7 +157,6 @@ fn create_room_tables_if_needed(conn: &DatabaseConnection) {
|
|||
FILES_TABLE
|
||||
);
|
||||
conn.execute(&files_table_cmd, params![]).expect("Couldn't create files table.");
|
||||
|
||||
let user_activity_table_cmd = format!(
|
||||
"CREATE TABLE IF NOT EXISTS {} (
|
||||
public_key TEXT PRIMARY KEY,
|
||||
|
@ -166,7 +164,8 @@ fn create_room_tables_if_needed(conn: &DatabaseConnection) {
|
|||
)",
|
||||
USER_ACTIVITY_TABLE,
|
||||
);
|
||||
conn.execute(&user_activity_table_cmd, params![]).expect("Couldn't create user activty table.");
|
||||
conn.execute(&user_activity_table_cmd, params![])
|
||||
.expect("Couldn't create user activity table.");
|
||||
}
|
||||
|
||||
// Pruning
|
||||
|
@ -323,8 +322,7 @@ pub fn perform_migration() {
|
|||
let rooms = match get_all_room_ids() {
|
||||
Ok(ids) => ids,
|
||||
Err(_e) => {
|
||||
error!("could not get all room ids");
|
||||
return;
|
||||
return error!("Couldn't get all room IDs.");
|
||||
}
|
||||
};
|
||||
for room in rooms {
|
||||
|
|
Loading…
Reference in New Issue