From a9ea6053e36cfaa17ef22f7499e0f305c8d9818a Mon Sep 17 00:00:00 2001 From: Zack Goodwin Date: Tue, 11 Jun 2024 13:45:59 -0400 Subject: [PATCH] EXP-660: Fix priority comparison --- .../com/indeed/proctor/common/Proctor.java | 18 +++++++++++------- .../common/model/PayloadExperimentConfig.java | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/proctor-common/src/main/java/com/indeed/proctor/common/Proctor.java b/proctor-common/src/main/java/com/indeed/proctor/common/Proctor.java index 3fee0139..c19008d2 100644 --- a/proctor-common/src/main/java/com/indeed/proctor/common/Proctor.java +++ b/proctor-common/src/main/java/com/indeed/proctor/common/Proctor.java @@ -561,13 +561,17 @@ private void attemptStoringProperty( final PayloadExperimentConfig newPayloadConfig = testChoosers.get(testName).getTestDefinition().getPayloadExperimentConfig(); // store property if it has higher priority than the currently stored property - if (isHigherPriority(currPayloadConfig, newPayloadConfig)) { - testProperties.put( - field.getKey(), - PayloadProperty.builder() - .value(field.getValue()) - .testName(testName) - .build()); + try { + if (isHigherPriority(currPayloadConfig, newPayloadConfig)) { + testProperties.put( + field.getKey(), + PayloadProperty.builder() + .value(field.getValue()) + .testName(testName) + .build()); + } + } catch (final NumberFormatException e) { + LOGGER.error("Failed to parse priority value to Long: ", e); } } } diff --git a/proctor-common/src/main/java/com/indeed/proctor/common/model/PayloadExperimentConfig.java b/proctor-common/src/main/java/com/indeed/proctor/common/model/PayloadExperimentConfig.java index dd99dd95..1e35b918 100644 --- a/proctor-common/src/main/java/com/indeed/proctor/common/model/PayloadExperimentConfig.java +++ b/proctor-common/src/main/java/com/indeed/proctor/common/model/PayloadExperimentConfig.java @@ -38,6 +38,7 @@ public static boolean isHigherPriority( && payloadConfig.getPriority() != null && otherPayloadConfig != null && otherPayloadConfig.getPriority() != null - && payloadConfig.getPriority().compareTo(otherPayloadConfig.getPriority()) < 0; + && Long.parseLong(payloadConfig.getPriority()) + < Long.parseLong(otherPayloadConfig.getPriority()); } }