add distinct identifying names. log errors in run_macro

This commit is contained in:
jude
2022-02-20 12:19:39 +00:00
parent 06c4deeaa9
commit 6ae2353c92
7 changed files with 102 additions and 40 deletions

View File

@ -12,7 +12,7 @@ mod models;
mod time_parser;
mod utils;
use std::{collections::HashMap, env, sync::atomic::AtomicBool};
use std::{collections::HashMap, env, fmt::Formatter, sync::atomic::AtomicBool};
use chrono_tz::Tz;
use dotenv::dotenv;
@ -45,6 +45,12 @@ pub struct Data {
is_loop_running: AtomicBool,
}
impl std::fmt::Debug for Data {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Data {{ .. }}")
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
env_logger::init();
@ -120,9 +126,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Pool::connect(&env::var("DATABASE_URL").expect("No database URL provided")).await.unwrap();
let popular_timezones = sqlx::query!(
"
SELECT timezone FROM users GROUP BY timezone ORDER BY COUNT(timezone) DESC LIMIT 21
"
"SELECT timezone FROM users GROUP BY timezone ORDER BY COUNT(timezone) DESC LIMIT 21"
)
.fetch_all(&database)
.await