-
Notifications
You must be signed in to change notification settings - Fork 83
feat: Added ODPEventManager implementation #789
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
Conversation
needs tests and REST API sendEvents()
# Conflicts: # packages/optimizely-sdk/lib/plugins/odp/odp_client.ts # packages/optimizely-sdk/lib/plugins/odp/odp_event.ts # packages/optimizely-sdk/lib/utils/enums/index.ts
Looks like there are older unit tests (around tests/v1EventProcessor.react_native.spec.ts) that are now failing. Fortunately, this also matches what's going on on my local dev machine. I'll try correcting these unit tests and create a predecessor PR that we can merge before this PR. I still think code reviews for Event Manager here can continue. |
This is ready for review @jaeopt & @zashraf1985 whenever you're available. I'll appreciate your thorough review. |
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Zeeshan Ashraf <35262377+zashraf1985@users.noreply.github.com>
Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com>
@zashraf1985, Thanks again for pair programming the round of reviews. I'm ready for another look by you and @jaeopt when you have a moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good. I see a possible failure in batching and a couple of suggestions to consider.
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall logic of event queue looks very good. I just have a concern in one asynchronous scenario that we can discuss on call. Also suggested a few minor changes here and there.
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
packages/optimizely-sdk/lib/plugins/odp/odp_event_dispatcher.ts
Outdated
Show resolved
Hide resolved
Good morning @jaeopt & @zashraf1985. You'll never guess, but I'm ready for another code review. 👍 😄 |
it('should attempt to flush an empty queue at flush intervals', async () => { | ||
const eventManager = new OdpEventManager({ | ||
odpConfig, apiManager, logger, clientEngine, clientVersion, | ||
flushInterval: 100, | ||
}); | ||
const spiedEventManager = spy(eventManager); | ||
|
||
eventManager.start(); | ||
// do not add events to the queue, but allow for... | ||
await pause(400); // at least 3 flush intervals executions (giving a little longer) | ||
|
||
verify(spiedEventManager['processQueue'](anything())).atLeast(3); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaeopt Is this a good test for ensuring flush intervals?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good! Great Work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @jaeopt and @zashraf1985 |
Summary
Added
OdpEventManager
implementation.Test plan
Jira
FSSDK-8443