Skip to content

Commit

Permalink
Move saving out of synchronized block
Browse files Browse the repository at this point in the history
  • Loading branch information
AsamK committed Dec 26, 2021
1 parent f7b2916 commit 3b81ba3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public List<GroupInfo> getGroups() {
}

public void mergeRecipients(final RecipientId recipientId, final RecipientId toBeMergedRecipientId) {
Storage storage = null;
synchronized (groups) {
var modified = false;
for (var group : this.groups.values()) {
Expand All @@ -201,9 +202,12 @@ public void mergeRecipients(final RecipientId recipientId, final RecipientId toB
}
}
if (modified) {
saver.save(toStorageLocked());
storage = toStorageLocked();
}
}
if (storage != null) {
saver.save(storage);
}
}

private GroupInfo getGroupLocked(final GroupId groupId) {
Expand Down

0 comments on commit 3b81ba3

Please sign in to comment.