You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(event processor): Flush current batch when event with different context received (#341)
Summary:
Prior to this change, event processor's buffer could contain events with different contexts. At flush time, the buffered events would be grouped by context and a request would be dispatched for each group.
With this change, we introduce an invariant: all events in the buffer share the same context. As soon as an event with different context is received, the queue is flushed. With this restriction, at most one request is dispatched per flush.
- A new comparator function (batchComparator) is provided to DefaultEventQueue. When enqueuing an event, batchComparator is used to determine whether the incoming event can be included into the current batch. If not, we flush.
- LogTierV1EventProcessor provides a batchComparator when constructing a DefaultEventQueue that checks equality of all context properties.
- In AbstractEventProcessor, the grouping step is removed from the flush process.
Test plan:
New unit tests. Manually tested.
Issues:
https://optimizely.atlassian.net/browse/OASIS-5160
Copy file name to clipboardExpand all lines: packages/event-processor/CHANGELOG.MD
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ Changes that have landed but are not yet released.
13
13
14
14
### Changed
15
15
- Removed transformers, interceptors, and callbacks from `AbstractEventProcessor`
16
+
- Removed grouping events by context and dispatching one event per group at flush time. Instead, only maintain one group and flush immediately when an incompatible event is processed.
0 commit comments