Read the portraits folders once and stop the card pass offline (#77)
The statistics list the portraits folder and its cards subfolder once instead of checking about 340 files. The tall-portrait pass is skipped when the catalog refresh failed and stops at the first network error; the core tells after each attempt whether a portrait was saved, so the worker's throttle can tell the page after any attempt, not only saves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
485d7b9065
commit
18b06f8ea6
5 files changed
+183
-53
No files matched your search
@@ -407,7 +407,7 @@ pub struct FakeChampions {
|
||||
catalog_calls: Arc<AtomicUsize>,
|
||||
/// What every card portrait download delivers.
|
||||
card_art: Vec<u8>,
|
||||
/// The card portrait downloads fail while this is set.
|
||||
/// The card portrait downloads fail with a network error while this is set.
|
||||
card_failure: Arc<AtomicBool>,
|
||||
card_calls: Arc<AtomicUsize>,
|
||||
}
|
||||
@@ -511,9 +511,12 @@ impl ChampionSource for FakeChampions {
|
||||
fn card_portrait(&self, key: &str) -> Result<Vec<u8>, SourceError> {
|
||||
self.card_calls.fetch_add(1, Ordering::SeqCst);
|
||||
self.check()?;
|
||||
if self.card_failure.load(Ordering::SeqCst) || self.no_portrait.iter().any(|k| k == key) {
|
||||
if self.card_failure.load(Ordering::SeqCst) {
|
||||
return Err(SourceError::Network("coupé".into()));
|
||||
}
|
||||
if self.no_portrait.iter().any(|k| k == key) {
|
||||
return Err(SourceError::NotFound);
|
||||
}
|
||||
Ok(self.card_art.clone())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user