Skip to content

Commit

Permalink
performance issue in minigl module getBalance()
Browse files Browse the repository at this point in the history
In getBalance, we were not taking advantage of the balance cache if maxId was 0.

Closes #76
  • Loading branch information
ar committed May 26, 2018
1 parent 201191e commit 97b652c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/minigl/src/main/java/org/jpos/gl/GLSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ public BigDecimal getBalance (Journal journal, Account acct, Date date, String l
Account a = (Account) iter.next();
BigDecimal[] b = getBalances (journal, a, date, inclusive, layersCopy, maxId);
balance[0] = balance[0].add (b[0]);
// session.evict (a); FIXME this conflicts with r251 (cascade=evict genearting a failed to lazily initialize a collection
// session.evict (a); FIXME this conflicts with r251 (cascade=evict generating a failed to lazily initialize a collection
}
}
else if (acct.isFinalAccount()) {
Expand All @@ -1069,7 +1069,7 @@ else if (acct.isFinalAccount()) {
}
} else {
BalanceCache bcache = getBalanceCache (journal, acct, layersCopy);
if (bcache != null && bcache.getRef() <= maxId) {
if (bcache != null && (maxId == 0 || bcache.getRef() <= maxId)) {
balance[0] = bcache.getBalance();
entryCrit.add (Restrictions.gt("id", bcache.getRef()));
}
Expand Down

0 comments on commit 97b652c

Please sign in to comment.