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

fix: concurrent event triggering unnecessary flush call #113

Merged
merged 3 commits into from
Aug 28, 2023

Conversation

MoumitaM
Copy link

@MoumitaM MoumitaM commented Aug 24, 2023

Description of the change

Concurrent events are triggering unnecessary flush calls resulting in a Bad request error.
So, moved the logic to remove batch items from the queue before waiting for the pending flush to avoid the above scenario.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

Fix #1

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers mentioned in a comment
  • Changes have been reviewed by at least one other engineer
  • Issue from task tracker has a link to this pull request

@MoumitaM MoumitaM requested a review from bardisg as a code owner August 24, 2023 11:39
package.json Outdated Show resolved Hide resolved
@MoumitaM MoumitaM requested a review from bardisg August 24, 2023 14:27
src/index.js Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Aug 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@@ -621,6 +621,11 @@ class Analytics {
}

const items = this.queue.splice(0, this.flushAt);
// Do not proceed in case the items array is empty
Copy link

Choose a reason for hiding this comment

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

if this fix resolves the issue we need it also in service worker for v1.1 and v3

Copy link
Author

Choose a reason for hiding this comment

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

We will add it

@bardisg bardisg self-requested a review August 28, 2023 11:48
@MoumitaM MoumitaM merged commit 5dd8999 into develop Aug 28, 2023
10 checks passed
@github-actions github-actions bot deleted the fix/sdk-382-node-sdk-concurrent-flush branch October 29, 2023 01:59
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