X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FClusterImpl.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FClusterImpl.java;h=4c8e19853f6b15ba9de73e3f08581580c9a25f60;hp=1baef88ac4fe9af7d9b664cef1b8026aff078f47;hb=0da8a106b00aead3a4bcdbaf1e911b4eb1845a24;hpb=4e11ae2950a62b7b720bcf2b7b8f9dc7e8cc4216 diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ClusterImpl.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ClusterImpl.java index 1baef88ac..4c8e19853 100644 --- a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ClusterImpl.java +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ClusterImpl.java @@ -118,12 +118,17 @@ public abstract class ClusterImpl extends ClusterBase implements Modifier, Colle public long getCachedSize() { if(dirtySizeInBytes) { + long oldSize = sizeInBytes; + if (oldSize > 0) + clusterTable.adjustCachedSize(-oldSize, this); try { sizeInBytes = getUsedSpace(); - //System.err.println("recomputed size of cluster " + getClusterId() + " => " + sizeInBytes); + //System.out.println("recomputed size of cluster " + getClusterId() + ": " + oldSize + " => " + sizeInBytes); } catch (DatabaseException e) { Logger.defaultLogError(e); } + if (sizeInBytes != 0) + clusterTable.adjustCachedSize(sizeInBytes, this); dirtySizeInBytes = false; } return sizeInBytes;