when there is no Internet connection and a dictionary is missing, cooldown time is applied before retrying
This commit is contained in:
parent
fa16517157
commit
819621cb98
1 changed files with 8 additions and 1 deletions
|
|
@ -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()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue