dump the content of the dump tasks instead of recreating at import time with wrong API keys

This commit is contained in:
Tamo 2022-10-17 17:38:31 +02:00 committed by Clément Renault
parent 09a0569228
commit dbcc3456c6
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
6 changed files with 54 additions and 37 deletions

View file

@ -34,7 +34,7 @@
use std::{
fs::{self, File},
io::{BufRead, BufReader},
io::{BufRead, BufReader, Seek, SeekFrom},
path::Path,
};
@ -176,12 +176,11 @@ impl V5Reader {
}))
}
pub fn keys(&mut self) -> Box<dyn Iterator<Item = Result<Key>> + '_> {
Box::new(
(&mut self.keys)
.lines()
.map(|line| -> Result<_> { Ok(serde_json::from_str(&line?)?) }),
)
pub fn keys(&mut self) -> Result<Box<dyn Iterator<Item = Result<Key>> + '_>> {
self.keys.seek(SeekFrom::Start(0))?;
Ok(Box::new((&mut self.keys).lines().map(
|line| -> Result<_> { Ok(serde_json::from_str(&line?)?) },
)))
}
}