fix(dictionary): no language goes missing while the curator updates
The update removed the files of sources no longer wanted first, Korean's words from Wiktionary among them, before KRDict's replacement was written, which on the first run after v0.16.0 came after Wiktionary's 3 GB conversion: the server unloaded Korean meanwhile, and for good if KRDict failed. Removal now comes last, and a replaced source stays until its replacement is there. A bare curate update, without --languages, no longer removes every other language. A KRDict export of another shape (the page's buttons reordered) is refused rather than written as a dictionary of no words over Korean's. The server never unloads from an empty dictionaries folder (a volume made anew), and a failed unload no longer stops the files from loading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
31eed85aff
commit
d5fe51b296
1 changed files with 84 additions and 12 deletions
|
|
@ -77,9 +77,16 @@ Future<void> _loadFolder(Session session, Directory directory) async {
|
|||
// A dictionary whose file is gone goes too (a language the instance no
|
||||
// longer keeps, a source the curator replaced: Korean's words from
|
||||
// Wiktionary before KRDict); only when every file could be read, as an
|
||||
// unreadable one may be the gone dictionary's.
|
||||
if (!unreadable) {
|
||||
await _unloadGone(session, held);
|
||||
// unreadable one may be the gone dictionary's, and never for a folder
|
||||
// with none, as a volume made anew or a mount gone wrong leaves it:
|
||||
// that would unload every dictionary. Failing, it leaves the files to
|
||||
// load all the same.
|
||||
if (!unreadable && files.isNotEmpty) {
|
||||
try {
|
||||
await _unloadGone(session, held);
|
||||
} on Object catch (error, st) {
|
||||
failed('Unloading dictionaries whose file is gone failed.', error, st);
|
||||
}
|
||||
}
|
||||
for (final MapEntry(key: source, value: files) in bySource.entries) {
|
||||
if (files.length > 1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue