Merge pull request #2665 from ByteHamster/prevent-thrashing
Prevent thrashing the database by opening and closing rapidly
This commit is contained in:
commit
c105a63165
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue