Skip to content

Commit 27e5454

Browse files
authored
feat: Use callbacks for evaluation hotpath. (#234)
1 parent cf01b14 commit 27e5454

File tree

5 files changed

+595
-398
lines changed

5 files changed

+595
-398
lines changed

packages/shared/sdk-server/__tests__/evaluation/Evaluator.segments.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ class TestQueries implements Queries {
3434
},
3535
) {}
3636

37-
async getFlag(key: string): Promise<Flag | undefined> {
38-
return this.data.flags?.find((flag) => flag.key === key);
37+
getFlag(key: string, cb: (flag: Flag | undefined) => void): void {
38+
const res = this.data.flags?.find((flag) => flag.key === key);
39+
cb(res);
3940
}
4041

41-
async getSegment(key: string): Promise<Segment | undefined> {
42-
return this.data.segments?.find((segment) => segment.key === key);
42+
getSegment(key: string, cb: (segment: Segment | undefined) => void): void {
43+
const res = this.data.segments?.find((segment) => segment.key === key);
44+
cb(res);
4345
}
4446

4547
getBigSegmentsMembership(

0 commit comments

Comments
 (0)