diff --git a/config/default.toml b/config/default.toml index 51d787df..1ab35feb 100644 --- a/config/default.toml +++ b/config/default.toml @@ -34,11 +34,11 @@ enable_stats = true [captcha.default_difficulty_strategy] avg_traffic_difficulty = 50000 # almost instant solution -#avg_traffic_time = 1 # almost instant solution +avg_traffic_time = 1 # almost instant solution peak_sustainable_traffic_difficulty = 3000000 # roughly 1.5s -#peak_sustainable_traffic_time = 3 +peak_sustainable_traffic_time = 3 broke_my_site_traffic_difficulty = 5000000 # greater than 3.5s -#broke_my_site_traffic_time = 5 +broke_my_site_traffic_time = 5 duration = 30 # cooldown period in seconds [database] diff --git a/src/easy.rs b/src/easy.rs index e6d880f1..2fbef169 100644 --- a/src/easy.rs +++ b/src/easy.rs @@ -55,6 +55,9 @@ impl UpdateEasyCaptcha { } let mut patterns = data.db.get_all_easy_captchas(limit, offset).await?; + if patterns.is_empty() { + break; + } for pattern in patterns.drain(0..) { if !Self::can_run(rx) { return Ok(()); @@ -85,6 +88,7 @@ impl UpdateEasyCaptcha { } page += 1; } + Ok(()) } fn can_run(rx: &mut Receiver<()>) -> bool {