diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2018-09-30 13:33:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-30 13:33:02 +0200 |
commit | c105a63165e6fcb42a3130153edfe24868956909 (patch) | |
tree | 792099c969cad451b11f571ecb1b3c7b47789bad /core | |
parent | e1422acae31dbd93871f7e833cfaebb5a9a3e09b (diff) | |
parent | 11c3a45f6e9beb661c3d4fec491f10155c217568 (diff) | |
download | AntennaPod-c105a63165e6fcb42a3130153edfe24868956909.zip |
Merge pull request #2665 from ByteHamster/prevent-thrashing
Prevent thrashing the database by opening and closing rapidly
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index bfca04d60..4bd2d8f19 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -20,6 +20,7 @@ import android.util.Log; import android.util.Pair; import android.webkit.URLUtil; +import de.danoeh.antennapod.core.storage.PodDBAdapter; import de.danoeh.antennapod.core.util.gui.NotificationUtils; import org.apache.commons.io.FileUtils; import org.xml.sax.SAXException; @@ -256,6 +257,7 @@ public class DownloadService extends Service { public void onCreate() { Log.d(TAG, "Service started"); isRunning = true; + PodDBAdapter.getInstance().open(); // Prevent thrashing the database by opening and closing rapidly handler = new Handler(); reportQueue = Collections.synchronizedList(new ArrayList<>()); downloads = Collections.synchronizedList(new ArrayList<>()); @@ -335,6 +337,7 @@ public class DownloadService extends Service { // start auto download in case anything new has shown up DBTasks.autodownloadUndownloadedItems(getApplicationContext()); + PodDBAdapter.getInstance().close(); } private void setupNotificationBuilders() { |