mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-11-24 14:35:46 +00:00
fix: exit loop when paginated DB query returns empty array
fixes: https://github.com/mCaptcha/mCaptcha/issues/154
This commit is contained in:
parent
91955501e2
commit
3a7e71b499
@ -55,6 +55,9 @@ impl UpdateEasyCaptcha {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut patterns = data.db.get_all_easy_captchas(limit, offset).await?;
|
let mut patterns = data.db.get_all_easy_captchas(limit, offset).await?;
|
||||||
|
if patterns.is_empty() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
for pattern in patterns.drain(0..) {
|
for pattern in patterns.drain(0..) {
|
||||||
if !Self::can_run(rx) {
|
if !Self::can_run(rx) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@ -85,6 +88,7 @@ impl UpdateEasyCaptcha {
|
|||||||
}
|
}
|
||||||
page += 1;
|
page += 1;
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn can_run(rx: &mut Receiver<()>) -> bool {
|
fn can_run(rx: &mut Receiver<()>) -> bool {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user