From ea93ab74760baaeca489c5d33f67190852a343e5 Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Fri, 29 Nov 2024 15:45:14 +0530 Subject: [PATCH] reverts without getting a db lock in case the data already exists to improve performance --- src/main/java/org/commcare/cases/entity/AsyncEntity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/commcare/cases/entity/AsyncEntity.java b/src/main/java/org/commcare/cases/entity/AsyncEntity.java index 133a3a088..d51fe837c 100755 --- a/src/main/java/org/commcare/cases/entity/AsyncEntity.java +++ b/src/main/java/org/commcare/cases/entity/AsyncEntity.java @@ -132,6 +132,11 @@ public String getNormalizedField(int i) { @Override public String getSortField(int i) { + synchronized (mAsyncLock) { + if (sortData[i] != null) { + return sortData[i]; + } + } try (Closeable ignored = mEntityStorageCache != null ? mEntityStorageCache.lockCache() : null) { //get our second lock. synchronized (mAsyncLock) {