1
0
Fork 0

when there is no Internet connection and a dictionary is missing, cooldown time is applied before retrying

This commit is contained in:
sspanak 2025-04-25 18:39:12 +03:00 committed by Dimo Karaivanov
parent fa16517157
commit 819621cb98

View file

@ -8,6 +8,7 @@ import android.os.Handler;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
@ -225,13 +226,19 @@ public class DictionaryLoader {
} catch (Exception | Error e) { } catch (Exception | Error e) {
stop(); stop();
sqlite.failTransaction(); sqlite.failTransaction();
self.lastAutoLoadAttemptTime.put(language.getId(), null);
sendError(e.getClass().getSimpleName(), language.getId()); sendError(e.getClass().getSimpleName(), language.getId());
if (e instanceof UnknownHostException) {
self.lastAutoLoadAttemptTime.put(language.getId(), System.currentTimeMillis());
} else {
self.lastAutoLoadAttemptTime.put(language.getId(), null);
}
Logger.e( Logger.e(
LOG_TAG, LOG_TAG,
"Failed loading dictionary: " + language.getDictionaryFile() "Failed loading dictionary: " + language.getDictionaryFile()
+ " for language '" + language.getName() + "'. " + " for language '" + language.getName() + "'. "
+ e.getClass().getSimpleName() + ": "
+ e.getMessage() + e.getMessage()
); );
} }