Save progress when interrupted
This commit is contained in:
parent
5f6c087097
commit
b4ce27a1b9
5 changed files with 40 additions and 1 deletions
10
src/wiki.rs
10
src/wiki.rs
|
@ -7,7 +7,7 @@ use wikitext_parser::{Attribute, TextPiece};
|
|||
use crate::{
|
||||
manifest::{placeholder, Os, Store, Tag},
|
||||
resource::ResourceFile,
|
||||
Error, Regularity, State,
|
||||
should_cancel, Error, Regularity, State,
|
||||
};
|
||||
|
||||
const SAVE_INTERVAL: u32 = 100;
|
||||
|
@ -212,6 +212,10 @@ impl WikiCache {
|
|||
.as_array()
|
||||
.ok_or(Error::WikiData("query.categorymembers"))?
|
||||
{
|
||||
if should_cancel() {
|
||||
break;
|
||||
}
|
||||
|
||||
let title = page["title"]
|
||||
.as_str()
|
||||
.ok_or(Error::WikiData("query.categorymembers[].title"))?;
|
||||
|
@ -277,6 +281,10 @@ impl WikiCache {
|
|||
});
|
||||
|
||||
for title in &titles {
|
||||
if should_cancel() {
|
||||
break;
|
||||
}
|
||||
|
||||
let cached = self.0.get(title).cloned().unwrap_or_default();
|
||||
|
||||
println!("Wiki: {}", title);
|
||||
|
|
Reference in a new issue