Skip to content

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

Merged
merged 36 commits into from
Oct 12, 2022

Conversation

mikechu-optimizely
Copy link
Contributor

Summary

Added OdpEventManager implementation.

Test plan

  • Unit tests added
  • Existing tests continue to pass

Jira

FSSDK-8443

@coveralls
Copy link

coveralls commented Sep 30, 2022

Coverage Status

Coverage decreased (-0.003%) to 93.463% when pulling 346da4e on mike/odp-event-manager into 8bc8ef5 on master.

@mikechu-optimizely
Copy link
Contributor Author

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.

@mikechu-optimizely
Copy link
Contributor Author

This is ready for review @jaeopt & @zashraf1985 whenever you're available. I'll appreciate your thorough review.

mikechu-optimizely and others added 2 commits October 3, 2022 17:23
Co-authored-by: Zeeshan Ashraf <35262377+zashraf1985@users.noreply.github.com>
@mikechu-optimizely
Copy link
Contributor Author

@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.

Copy link
Contributor

@jaeopt jaeopt left a 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.

Copy link
Contributor

@zashraf1985 zashraf1985 left a 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.

@mikechu-optimizely
Copy link
Contributor Author

Good morning @jaeopt & @zashraf1985. You'll never guess, but I'm ready for another code review. 👍 😄

Comment on lines +207 to +219
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);
});
Copy link
Contributor Author

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?

Copy link
Contributor

@zashraf1985 zashraf1985 left a 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!

Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

LGTM

@mikechu-optimizely mikechu-optimizely merged commit 510d247 into master Oct 12, 2022
@mikechu-optimizely mikechu-optimizely deleted the mike/odp-event-manager branch October 12, 2022 17:06
@mikechu-optimizely
Copy link
Contributor Author

Thanks @jaeopt and @zashraf1985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants