Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
EXP-660: Fix priority comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharygoodwin committed Jun 11, 2024
1 parent dee4dab commit a9ea605
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit a9ea605

Please sign in to comment.