Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/jni/JniFilterEngine.cpp

Issue 29567613: Issue 5572 - reduce the probability of the race condition while updating of preloaded subscriptions Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: Created Oct. 6, 2017, 9:06 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libadblockplus-android/jni/JniFilterEngine.cpp
diff --git a/libadblockplus-android/jni/JniFilterEngine.cpp b/libadblockplus-android/jni/JniFilterEngine.cpp
index 1f59aac630f338d3a92483dddde2b57cc2018b3f..b8517acdb08e3f3fed9f9f4454439dc9b4b6fb52 100644
--- a/libadblockplus-android/jni/JniFilterEngine.cpp
+++ b/libadblockplus-android/jni/JniFilterEngine.cpp
@@ -485,7 +485,7 @@ static void JNICALL JniUpdateFiltersAsync(JNIEnv* env, jclass clazz, jlong jniPl
{
std::string subscriptionUrl = JniJavaToStdString(env, jSubscriptionUrl);
auto jniPlatform = JniLongToTypePtr<JniPlatform>(jniPlatformPtr);
- jniPlatform->scheduler([jniPlatform, subscriptionUrl]
+ auto updateSubscriptionFilters = [jniPlatform, subscriptionUrl]
{
auto& filterEngine = jniPlatform->platform->GetFilterEngine();
for (auto& subscription : filterEngine.GetListedSubscriptions())
@@ -496,6 +496,10 @@ static void JNICALL JniUpdateFiltersAsync(JNIEnv* env, jclass clazz, jlong jniPl
return;
}
}
+ };
+ jniPlatform->platform->WithTimer([updateSubscriptionFilters](AdblockPlus::ITimer& timer)
+ {
+ timer.SetTimer(std::chrono::milliseconds(300), updateSubscriptionFilters);
anton 2017/10/06 10:38:08 I don't like such timers a lot. It's always introd
sergei 2017/10/06 13:37:03 As discussed in the issue, it does not help.
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld