Skip to content

Commit d829ebf

Browse files
[FSSDK-11981] review update
1 parent dd2a296 commit d829ebf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/core/decision_service/cmab/cmab_service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import murmurhash from "murmurhash";
2525
import { DecideOptionsMap } from "..";
2626
import { SerialRunner } from "../../../utils/executor/serial_runner";
2727
import {
28-
CMAB_CACHE_ATTRIBUTES_MISMATCH,
28+
CMAB_CACHE_HIT,
29+
CMAB_CACHE_MISS,
2930
IGNORE_CMAB_CACHE,
3031
INVALIDATE_CMAB_CACHE,
3132
RESET_CMAB_CACHE,
@@ -66,6 +67,7 @@ export type CmabServiceOptions = {
6667

6768
const SERIALIZER_BUCKETS = 1000;
6869
const LOGGER_NAME = 'CmabService';
70+
6971
export class DefaultCmabService implements CmabService {
7072
private cmabCache: CacheWithRemove<CmabCacheValue>;
7173
private cmabClient: CmabClient;
@@ -132,9 +134,10 @@ export class DefaultCmabService implements CmabService {
132134

133135
if (cachedValue) {
134136
if (cachedValue.attributesHash === attributesHash) {
137+
this.logger?.debug(CMAB_CACHE_HIT, userId, ruleId);
135138
return { variationId: cachedValue.variationId, cmabUuid: cachedValue.cmabUuid };
136139
} else {
137-
this.logger?.debug(CMAB_CACHE_ATTRIBUTES_MISMATCH, userId, ruleId);
140+
this.logger?.debug(CMAB_CACHE_MISS, userId, ruleId);
138141
this.cmabCache.remove(cacheKey);
139142
}
140143
}

lib/message/log_message.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const EVENT_STORE_FULL = 'Event store is full. Not saving event with id %
6464
export const IGNORE_CMAB_CACHE = 'Ignoring CMAB cache for user %s and rule %s.';
6565
export const RESET_CMAB_CACHE = 'Resetting CMAB cache for user %s and rule %s.';
6666
export const INVALIDATE_CMAB_CACHE = 'Invalidating CMAB cache for user %s and rule %s.';
67-
export const CMAB_CACHE_ATTRIBUTES_MISMATCH = 'CMAB cache attributes mismatch for user %s and rule %s, fetching new decision.';
67+
export const CMAB_CACHE_HIT = 'Cache hit for user %s and rule %s.';
68+
export const CMAB_CACHE_MISS = 'Cache miss for user %s and rule %s.';
6869

6970
export const messages: string[] = [];

0 commit comments

Comments
 (0)