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

♻️ [RUMF-1533] extract the Flush logic into a reusable component #2144

Merged
merged 7 commits into from
Apr 11, 2023

Conversation

BenoitZugmeyer
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer commented Apr 6, 2023

Motivation

The flush logic will become a bit more complex in the short term. Let's extract the flush logic from Batch to separate concerns. In a future PR, the newly introduced flush controller will also be used for flushing segments.

Changes

  • Implement a flush controller to handle all flush use cases
  • Use it in Batch
  • Use it for customer data telemetry

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review April 6, 2023 17:57
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner April 6, 2023 17:57

expect(sendSpy).toHaveBeenCalled()
flushController.willAddMessage.calls.reset()
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ question: ‏Why do you need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I need to call reset to reset the number of calls after the test setup, so I can use expect().toHaveBeenCalledOnceWith(...) (only the last call is relevent to this test case)

packages/core/src/transport/flushController.ts Outdated Show resolved Hide resolved
packages/core/src/transport/flushController.ts Outdated Show resolved Hide resolved
packages/core/src/transport/batch.ts Outdated Show resolved Hide resolved
packages/core/src/transport/flushController.spec.ts Outdated Show resolved Hide resolved
@BenoitZugmeyer BenoitZugmeyer merged commit 7459938 into main Apr 11, 2023
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/flush-controller--batch branch April 11, 2023 11:54
@BenoitZugmeyer BenoitZugmeyer mentioned this pull request Apr 11, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants