-
Notifications
You must be signed in to change notification settings - Fork 295
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 bug where AnalyticsServices fires same event multiple times #1210
Conversation
… AnalyticsService.sendAnalyticEvent() method call Signed-off-by: Jax DesMarais-Leder <[email protected]>
Signed-off-by: Jax DesMarais-Leder <[email protected]>
apiClient.fetchOrReturnRemoteConfiguration { configuration, error in | ||
guard let configuration, error == nil else { | ||
if let error { | ||
completion(error) |
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.
This completion was always ignored, so we removed it entirely
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.
Curious why this is happening, thoughts?
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.
BTAPIClient
was always no-oping the result of this completion. I don't think we would ever want to return an error to the merchant and stop the flow if there is an issue with analytics since that's just for us, so this is safe for us to remove since we just discarded the result.
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.
Love how this bug also got rid of our recently problematic tests. 😂
Co-authored-by: Jax DesMarais-Leder <[email protected]>
# Conflicts: # CHANGELOG.md # Sources/BraintreeCore/Analytics/BTAnalyticsService.swift # Sources/BraintreeCore/BTAPIClient.swift # UnitTests/BraintreeCoreTests/Analytics/FakeAnalyticsService.swift
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 great and super clean! 🚀
Summary
sendAnalyticsEvent()
was called, but with this change, the payload won't contain duplicate eventsChanges
flushThreshold
& flush logic (this was never called within the SDK)DispatchQueue
for holding events. This was never getting cleared, thus sending every event multiple times. We can re-add this when we have more time to properly implement the queue's maintenance and clearance.BTAnalyticsService.sendAnalyticsEvent()
methodChecklist
Authors
@scannillo @jaxdesmarais