feat: migrate fetching stats to use db_*

This commit is contained in:
realaravinth
2022-05-27 17:09:27 +05:30
parent bc90a51d30
commit 098d0cfc24
10 changed files with 50 additions and 299 deletions

View File

@@ -49,7 +49,7 @@ pub async fn get_config(
match data.captcha.get_pow(payload.key.clone()).await {
Ok(Some(config)) => {
data.stats.record_fetch(&data, &payload.key).await;
data.stats.record_fetch(&data, &payload.key).await?;
Ok(HttpResponse::Ok().json(config))
}
Ok(None) => {
@@ -61,7 +61,7 @@ pub async fn get_config(
.expect("mcaptcha should be initialized and ready to go");
// background it. would require data::Data to be static
// to satidfy lifetime
data.stats.record_fetch(&data, &payload.key).await;
data.stats.record_fetch(&data, &payload.key).await?;
Ok(HttpResponse::Ok().json(config))
}
Err(e) => Err(e.into()),