kill pending queries when archiving conversation
This commit is contained in:
parent
3c60de54cb
commit
8764d11cce
|
@ -209,7 +209,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
}
|
}
|
||||||
|
|
||||||
void executePendingQueries(final Account account) {
|
void executePendingQueries(final Account account) {
|
||||||
List<Query> pending = new ArrayList<>();
|
final List<Query> pending = new ArrayList<>();
|
||||||
synchronized (this.pendingQueries) {
|
synchronized (this.pendingQueries) {
|
||||||
for (Iterator<Query> iterator = this.pendingQueries.iterator(); iterator.hasNext(); ) {
|
for (Iterator<Query> iterator = this.pendingQueries.iterator(); iterator.hasNext(); ) {
|
||||||
Query query = iterator.next();
|
Query query = iterator.next();
|
||||||
|
@ -390,8 +390,17 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void kill(Conversation conversation) {
|
void kill(final Conversation conversation) {
|
||||||
final ArrayList<Query> toBeKilled = new ArrayList<>();
|
final ArrayList<Query> toBeKilled = new ArrayList<>();
|
||||||
|
synchronized (this.pendingQueries) {
|
||||||
|
for (final Iterator<Query> iterator = this.pendingQueries.iterator(); iterator.hasNext(); ) {
|
||||||
|
final Query query = iterator.next();
|
||||||
|
if (query.getConversation() == conversation) {
|
||||||
|
iterator.remove();
|
||||||
|
Log.d(Config.LOGTAG, conversation.getAccount().getJid().asBareJid() + ": killed pending MAM query for archived conversation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
synchronized (this.queries) {
|
synchronized (this.queries) {
|
||||||
for (final Query q : queries) {
|
for (final Query q : queries) {
|
||||||
if (q.conversation == conversation) {
|
if (q.conversation == conversation) {
|
||||||
|
@ -399,7 +408,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Query q : toBeKilled) {
|
for (final Query q : toBeKilled) {
|
||||||
kill(q);
|
kill(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue