Skip to content

Commit

Permalink
fix: resolve mock repeated matching questions (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
pangdayuan1 authored Dec 4, 2023
1 parent 91de109 commit e172071
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,14 @@ private byte[] getMockResultWithSimilarityMatch(MockCategoryType category,
String id = CacheKeyUtils.fromUtf8Bytes(mockResultId);
mockItem.setId(id);
long increasesCount = increasesReplayConsumer(category, recordIdBytes, replayIdBytes, mockResultId);
matchStrategyMetricService.recordMatchingCount(MULTI_OPERATION_WITH_STRICT_MATCH, (AREXMocker) mockItem);
LOGGER.info(
"[[title=similarityMatch]]get mock result with strictly match, instanceId: {}, increasesCount: {}",
id, increasesCount);
return result;
if (increasesCount <= 1L) {
matchStrategyMetricService.recordMatchingCount(MULTI_OPERATION_WITH_STRICT_MATCH,
(AREXMocker) mockItem);
LOGGER.info(
"[[title=similarityMatch]]get mock result with strictly match, instanceId: {}, increasesCount: {}",
id, increasesCount);
return result;
}
}

// 3. use similarity match
Expand Down Expand Up @@ -649,12 +652,14 @@ public byte[] getMockResultWithEigenMatch(MockCategoryType category,
String id = CacheKeyUtils.fromUtf8Bytes(mockResultId);
mockItem.setId(id);
long increasesCount = increasesReplayConsumer(category, recordIdBytes, replayIdBytes, mockResultId);
matchStrategyMetricService.recordMatchingCount(MULTI_OPERATION_WITH_STRICT_MATCH,
(AREXMocker) mockItem);
LOGGER.info(
"[[title=eigenMatch]]get mock result with eigen match, instanceId: {}, increasesCount: {}",
id, increasesCount);
return result;
if (increasesCount <= 1L) {
matchStrategyMetricService.recordMatchingCount(MULTI_OPERATION_WITH_STRICT_MATCH,
(AREXMocker) mockItem);
LOGGER.info(
"[[title=eigenMatch]]get mock result with eigen match, instanceId: {}, increasesCount: {}",
id, increasesCount);
return result;
}
}

// 3. use eigen to match
Expand Down

0 comments on commit e172071

Please sign in to comment.