From 120624a2013da767d8bf19cf8849c2e2376f46f6 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sat, 3 Oct 2026 10:14:16 -0700 Subject: [PATCH 1/2] Use GUID instead of Container as cache key --- src/org/labkey/targetedms/TargetedMSManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/labkey/targetedms/TargetedMSManager.java b/src/org/labkey/targetedms/TargetedMSManager.java index 986230427..760c45a9d 100644 --- a/src/org/labkey/targetedms/TargetedMSManager.java +++ b/src/org/labkey/targetedms/TargetedMSManager.java @@ -89,6 +89,7 @@ import org.labkey.api.targetedms.TargetedMSService; import org.labkey.api.targetedms.model.SampleFileInfo; import org.labkey.api.util.FileUtil; +import org.labkey.api.util.GUID; import org.labkey.api.util.StringUtilsLabKey; import org.labkey.api.util.logging.LogHelper; import org.labkey.api.view.NotFoundException; @@ -164,7 +165,8 @@ private TargetedMSManager() * A cache to make it faster to render QC folders. A number of API calls come from the * client rendering the overview, all of which need to know the enabled configs. */ - private static final Cache> _metricCache = CacheManager.getBlockingCache(1000, TimeUnit.HOURS.toMillis(1), "Enabled QC metric configs", + // Keyed by GUID, not Container: a hit on an equal key keeps the original key object, pinning stale Container copies + private static final Cache> _metricCache = CacheManager.getBlockingCache(1000, TimeUnit.HOURS.toMillis(1), "Enabled QC metric configs", (_, argument) -> { if (!(argument instanceof TargetedMSSchema schema)) @@ -2437,7 +2439,7 @@ private static Double getValue(Object o) public static List getAllQCMetricConfigurations(TargetedMSSchema schema) { - return _metricCache.get(schema.getContainer(), schema, null); + return _metricCache.get(schema.getContainer().getEntityId(), schema, null); } public static List getEnabledQCMetricConfigurations(TargetedMSSchema schema) { @@ -3065,7 +3067,7 @@ public static Map getQCFolderDateRange(Container container) */ public void clearQCMetricCache(Container container, boolean clearMetricValues) { - getSchema().getScope().addCommitTask(() -> _metricCache.remove(container), DbScope.CommitTaskOption.IMMEDIATE, DbScope.CommitTaskOption.POSTCOMMIT, DbScope.CommitTaskOption.POSTROLLBACK); + getSchema().getScope().addCommitTask(() -> _metricCache.remove(container.getEntityId()), DbScope.CommitTaskOption.IMMEDIATE, DbScope.CommitTaskOption.POSTCOMMIT, DbScope.CommitTaskOption.POSTROLLBACK); if (clearMetricValues) { From fbdca14c3fdf8d6ce066679b3795722c817e7da1 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sat, 3 Oct 2026 11:00:59 -0700 Subject: [PATCH 2/2] Reduce per-container memory; cache by GUID not Container --- src/org/labkey/targetedms/TargetedMSManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/org/labkey/targetedms/TargetedMSManager.java b/src/org/labkey/targetedms/TargetedMSManager.java index 760c45a9d..f30856a16 100644 --- a/src/org/labkey/targetedms/TargetedMSManager.java +++ b/src/org/labkey/targetedms/TargetedMSManager.java @@ -165,7 +165,6 @@ private TargetedMSManager() * A cache to make it faster to render QC folders. A number of API calls come from the * client rendering the overview, all of which need to know the enabled configs. */ - // Keyed by GUID, not Container: a hit on an equal key keeps the original key object, pinning stale Container copies private static final Cache> _metricCache = CacheManager.getBlockingCache(1000, TimeUnit.HOURS.toMillis(1), "Enabled QC metric configs", (_, argument) -> {