Merge pull request #4143 from osmandapp/search_fix

Fix #3805
This commit is contained in:
Alexey 2017-07-19 12:19:16 +03:00 committed by GitHub
commit f04c0e6460

View file

@ -372,7 +372,13 @@ public class SearchUICore {
SearchResultMatcher rm = new SearchResultMatcher(matcher, phrase, request, requestNumber, totalLimit); SearchResultMatcher rm = new SearchResultMatcher(matcher, phrase, request, requestNumber, totalLimit);
rm.searchStarted(phrase); rm.searchStarted(phrase);
if (TIMEOUT_BETWEEN_CHARS > 0 && delayedExecution) { if (TIMEOUT_BETWEEN_CHARS > 0 && delayedExecution) {
Thread.sleep(TIMEOUT_BETWEEN_CHARS); long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() - startTime <= TIMEOUT_BETWEEN_CHARS) {
if (rm.isCancelled()) {
return;
}
Thread.sleep(TIMEOUT_BEFORE_SEARCH);
}
} else if (TIMEOUT_BEFORE_SEARCH > 0) { } else if (TIMEOUT_BEFORE_SEARCH > 0) {
Thread.sleep(TIMEOUT_BEFORE_SEARCH); Thread.sleep(TIMEOUT_BEFORE_SEARCH);
} }