Lower maximum size of cursor window on DB upgrade.

On some systems, the DB upgrade was failing because there were
too many rows for the cursor window.  This moves some looping
operations into single update statements by using the substr()
command, and chunks the rest using a series of LIMITs.
This commit is contained in:
Moxie Marlinspike
2013-05-16 13:16:42 -07:00
parent f44ee4a41a
commit be34f30719
3 changed files with 206 additions and 217 deletions

View File

@@ -32,6 +32,7 @@ import android.util.Log;
import android.widget.RemoteViews;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.DatabaseUpgradeActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.RoutingActivity;
import org.thoughtcrime.securesms.crypto.DecryptingQueue;
@@ -78,8 +79,10 @@ public class KeyCachingService extends Service {
new Thread() {
@Override
public void run() {
DecryptingQueue.schedulePendingDecrypts(KeyCachingService.this, masterSecret);
MessageNotifier.updateNotification(KeyCachingService.this, masterSecret);
if (!DatabaseUpgradeActivity.isUpdate(KeyCachingService.this)) {
DecryptingQueue.schedulePendingDecrypts(KeyCachingService.this, masterSecret);
MessageNotifier.updateNotification(KeyCachingService.this, masterSecret);
}
}
}.start();
}