Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix bandit events queue. #200

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eppo/js-client-sdk-common",
"version": "4.9.0-alpha.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last release was 4.8.1 so this will be a patch

"version": "4.8.2",
"description": "Common library for Eppo JavaScript SDKs (web, react native, and node)",
"main": "dist/index.js",
"files": [
Expand Down
6 changes: 3 additions & 3 deletions src/client/eppo-precomputed-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
} from '../constants';
import { decodePrecomputedFlag } from '../decoding';
import { FlagEvaluationWithoutDetails } from '../evaluator';
import { BoundedEventQueue } from '../events/bounded-event-queue';
import FetchHttpClient from '../http-client';
import {
IPrecomputedBandit,
Expand Down Expand Up @@ -68,8 +67,7 @@ interface EppoPrecomputedClientOptions {

export default class EppoPrecomputedClient {
private readonly queuedAssignmentEvents: IAssignmentEvent[] = [];
private readonly banditEventsQueue: BoundedEventQueue<IBanditEvent> =
new BoundedEventQueue<IBanditEvent>('bandit');
private readonly banditEventsQueue: IBanditEvent[] = [];
private assignmentLogger?: IAssignmentLogger;
private banditLogger?: IBanditLogger;
private banditAssignmentCache?: AssignmentCache;
Expand Down Expand Up @@ -381,6 +379,8 @@ export default class EppoPrecomputedClient {

public setBanditLogger(logger: IBanditLogger) {
this.banditLogger = logger;
// log any bandit events that may have been queued while initializing
this.flushQueuedEvents(this.banditEventsQueue, this.banditLogger?.logBanditAction);
}

/**
Expand Down
Loading