From f297a3475c919ba1c2b65b70da65239fa4b01880 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 13 Mar 2013 15:02:10 -0700 Subject: [PATCH] Delete outstanding entries for entities that don't exist anymore --- .../todoroo/astrid/actfm/sync/messages/ChangesHappened.java | 2 ++ .../astrid/actfm/sync/messages/ClientToServerMessage.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ChangesHappened.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ChangesHappened.java index 1b83b4ed1..12cd11537 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ChangesHappened.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ChangesHappened.java @@ -80,6 +80,8 @@ public class ChangesHappened(); + if (!foundEntity) // Stop sending changes for entities that don't exist anymore + outstandingDao.deleteWhere(OutstandingEntry.ENTITY_ID_PROPERTY.eq(id)); } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java index c6e6229e4..fff800665 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java @@ -20,6 +20,7 @@ public abstract class ClientToServerMessage { protected final long id; protected final String uuid; protected final long pushedAt; + protected final boolean foundEntity; public static final String TYPE_KEY = "type"; public static final String TABLE_KEY = "table"; @@ -32,6 +33,7 @@ public abstract class ClientToServerMessage { this.table = NameMaps.getServerNameForTable(tableClass); this.uuid = uuid; this.pushedAt = pushedAt; + this.foundEntity = true; this.id = AbstractModel.NO_ID; } @@ -42,6 +44,7 @@ public abstract class ClientToServerMessage { this.table = NameMaps.getServerNameForTable(tableClass); TYPE entity = getEntity(id, modelDao); + this.foundEntity = entity != null; if (entity == null) { this.uuid = RemoteModel.NO_UUID; this.pushedAt = 0;