Skip to content

Commit 7f88191

Browse files
committed
up
1 parent df1c3f2 commit 7f88191

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

lib/event_processor/batch_event_processor.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export const MAX_EVENTS_IN_STORE = 500;
3939
export type EventWithId = {
4040
id: string;
4141
event: ProcessableEvent;
42-
// notStored?: boolean;
4342
};
4443

4544
export type RetryConfig = {
@@ -92,7 +91,6 @@ export class BatchEventProcessor extends BaseService implements EventProcessor {
9291
this.dispatchRepeater = config.dispatchRepeater;
9392
this.dispatchRepeater.setTask(() => this.flush());
9493

95-
// this.maxEventsInStore = Math.max(2 * config.batchSize, MAX_EVENTS_IN_STORE);
9694
this.failedEventRepeater = config.failedEventRepeater;
9795
this.failedEventRepeater?.setTask(() => this.retryFailedEvents());
9896
if (config.logger) {

lib/event_processor/event_processor_factory.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
import { LogLevel } from "../logging/logger";
1818
import { StartupLog } from "../service";
19+
import { AsyncPrefixStore, Store, SyncPrefixStore } from "../utils/cache/store";
20+
import { validateStore } from "../utils/cache/store_validator";
1921
import { ExponentialBackoff, IntervalRepeater } from "../utils/repeater/repeater";
22+
import { Maybe } from "../utils/type";
23+
import { BatchEventProcessor, DEFAULT_MAX_BACKOFF, DEFAULT_MIN_BACKOFF, EventWithId, RetryConfig } from "./batch_event_processor";
2024
import { EventDispatcher } from "./event_dispatcher/event_dispatcher";
2125
import { EventProcessor } from "./event_processor";
26+
import { EVENT_STORE_PREFIX } from "./event_store";
2227
import { ForwardingEventProcessor } from "./forwarding_event_processor";
23-
import { BatchEventProcessor, DEFAULT_MAX_BACKOFF, DEFAULT_MIN_BACKOFF, EventWithId, RetryConfig } from "./batch_event_processor";
24-
import { AsyncPrefixStore, Store, SyncPrefixStore } from "../utils/cache/store";
25-
import { Maybe } from "../utils/type";
26-
import { validateStore } from "../utils/cache/store_validator";
27-
import { DEFAULT_MAX_EVENTS_IN_STORE, EVENT_STORE_PREFIX, EventStore } from "./event_store";
2828

2929
export const INVALID_EVENT_DISPATCHER = 'Invalid event dispatcher';
3030

lib/event_processor/event_store.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { createImpressionEvent } from '../tests/mock/create_event';
2121

2222
import { DEFAULT_MAX_EVENTS_IN_STORE } from './event_store';
2323
import { exhaustMicrotasks } from '../tests/testUtils';
24-
import { EVENT_STORE_FULL } from '../message/log_message';
24+
import { EVENT_STORE_FULL } from 'error_message';
2525
import { OptimizelyError } from '../error/optimizly_error';
2626

2727
type TestStoreConfig = {

lib/event_processor/event_store.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
import { EventWithId } from "./batch_event_processor";
2-
import { AsyncPrefixStore, AsyncStore, AsyncStoreWithBatchedGet, Store, StoreWithBatchedGet, SyncPrefixStore } from "../utils/cache/store";
3-
import { Maybe } from "../utils/type";
4-
import { SerialRunner } from "../utils/executor/serial_runner";
5-
import { LoggerFacade } from "../logging/logger";
6-
import { EVENT_STORE_FULL } from "../message/log_message";
71
import { OptimizelyError } from "../error/optimizly_error";
2+
import { LoggerFacade } from "../logging/logger";
3+
import { EVENT_STORE_FULL } from "error_message";
4+
import {
5+
AsyncPrefixStore,
6+
AsyncStore,
7+
AsyncStoreWithBatchedGet,
8+
Store,
9+
StoreWithBatchedGet,
10+
SyncPrefixStore
11+
} from "../utils/cache/store";
12+
import { SerialRunner } from "../utils/executor/serial_runner";
13+
import { Maybe } from "../utils/type";
14+
import { EventWithId } from "./batch_event_processor";
815

916
export type StoredEvent = EventWithId & {
1017
expiresAt?: number;
@@ -80,7 +87,6 @@ export class EventStore extends AsyncStoreWithBatchedGet<EventWithId> implements
8087
// readKeys might have failed, in that case we cannot enforce max size
8188
// that means, the store might grow beyond max size in failure scenarios
8289
if (this.keys !== undefined && this.keys.size >= this.maxSize) {
83-
this.logger?.info(EVENT_STORE_FULL, event.event.uuid);
8490
return Promise.reject(new OptimizelyError(EVENT_STORE_FULL, event.event.uuid));
8591
}
8692

lib/message/error_message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,6 @@ export const CMAB_FETCH_FAILED = 'CMAB decision fetch failed with status: %s';
9696
export const INVALID_CMAB_FETCH_RESPONSE = 'Invalid CMAB fetch response';
9797
export const PROMISE_NOT_ALLOWED = "Promise value is not allowed in sync operation";
9898
export const SERVICE_NOT_RUNNING = "%s not running";
99+
export const EVENT_STORE_FULL = 'Event store is full. Not saving event with id %d.';
99100

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

lib/message/log_message.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export const USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT =
6060
'No experiment %s mapped to user %s in the forced variation map.';
6161
export const INVALID_EXPERIMENT_KEY_INFO =
6262
'Experiment key %s is not in datafile. It is either invalid, paused, or archived.';
63-
export const EVENT_STORE_FULL = 'Event store is full. Not saving event with id %d.';
6463
export const IGNORE_CMAB_CACHE = 'Ignoring CMAB cache for user %s and rule %s.';
6564
export const RESET_CMAB_CACHE = 'Resetting CMAB cache for user %s and rule %s.';
6665
export const INVALIDATE_CMAB_CACHE = 'Invalidating CMAB cache for user %s and rule %s.';

0 commit comments

Comments
 (0)