mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-29 19:21:33 -07:00
fix(anki): preserve known-word cache when maturity fetch fails
- Catch errors from fetchKnownWordMaturityTierSets so a failed tier query no longer aborts the whole refresh - Known words still cache; tiers just stay null until the next successful refresh - Add regression test covering findNotes failure on a tier query
This commit is contained in:
@@ -389,13 +389,18 @@ export class KnownWordCacheManager {
|
||||
this.isRefreshingKnownWords = true;
|
||||
try {
|
||||
const noteFieldsById = await this.fetchKnownWordNoteFieldsById();
|
||||
const tierSets = this.isMaturityTrackingEnabled()
|
||||
? await fetchKnownWordMaturityTierSets(
|
||||
let tierSets = null;
|
||||
if (this.isMaturityTrackingEnabled()) {
|
||||
try {
|
||||
tierSets = await fetchKnownWordMaturityTierSets(
|
||||
(query, options) => this.deps.client.findNotes(query, options),
|
||||
this.getKnownWordQueryScopes().map((scope) => scope.query),
|
||||
getMatureIntervalThresholdDays(this.deps.getConfig()),
|
||||
)
|
||||
: null;
|
||||
);
|
||||
} catch (error) {
|
||||
log.warn('Failed to fetch known-word maturity tiers:', (error as Error).message);
|
||||
}
|
||||
}
|
||||
const currentNoteIds = Array.from(noteFieldsById.keys()).sort((a, b) => a - b);
|
||||
|
||||
if (this.noteEntriesById.size === 0) {
|
||||
|
||||
Reference in New Issue
Block a user