prevent deadlock in case auto feed update is blocked per review.
This commit is contained in:
parent
907867652f
commit
366146d22e
|
@ -34,13 +34,13 @@ public class FeedUpdateWorker extends Worker {
|
||||||
Log.d(TAG, "doWork() : isImmediate = " + isImmediate);
|
Log.d(TAG, "doWork() : isImmediate = " + isImmediate);
|
||||||
ClientConfig.initialize(getApplicationContext());
|
ClientConfig.initialize(getApplicationContext());
|
||||||
|
|
||||||
AtomicBoolean finished = new AtomicBoolean(false);
|
|
||||||
if (NetworkUtils.networkAvailable() && NetworkUtils.isFeedRefreshAllowed()) {
|
if (NetworkUtils.networkAvailable() && NetworkUtils.isFeedRefreshAllowed()) {
|
||||||
|
AtomicBoolean finished = new AtomicBoolean(false);
|
||||||
DBTasks.refreshAllFeeds(getApplicationContext(), null, () -> finished.set(true));
|
DBTasks.refreshAllFeeds(getApplicationContext(), null, () -> finished.set(true));
|
||||||
|
Awaitility.await().until(finished::get);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed");
|
Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed");
|
||||||
}
|
}
|
||||||
Awaitility.await().until(finished::get);
|
|
||||||
|
|
||||||
if (!isImmediate && UserPreferences.isAutoUpdateTimeOfDay()) {
|
if (!isImmediate && UserPreferences.isAutoUpdateTimeOfDay()) {
|
||||||
// WorkManager does not allow to set specific time for repeated tasks.
|
// WorkManager does not allow to set specific time for repeated tasks.
|
||||||
|
|
Loading…
Reference in New Issue