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(Analytics): Fixing crash when attempting to submit events while a previous submission is in progress #3331

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

ruisebas
Copy link
Member

Issue #

Description

This PR fixes a crash that was happening when EventRecorder.submitAllEvents() was called while a previous submission was still ongoing.
This happened because the submittedEvents array was being populated by the previous submission, while the very first thing a new one does is to set it to [].

I am changing the behaviour so that submitAllEvents now waits until the previous submission ends before continuing. I've explored just using a lock to manipulate the array instead, but while that did fix the crash, it would still produce undetermined behaviour when the array was emptied.

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ruisebas ruisebas requested a review from a team as a code owner October 26, 2023 21:02
@ruisebas ruisebas temporarily deployed to Fortify October 30, 2023 18:13 — with GitHub Actions Inactive
@ruisebas ruisebas merged commit ccd0545 into main Nov 1, 2023
76 checks passed
@ruisebas ruisebas deleted the ruisebas/fix_analytics_crash branch November 1, 2023 18:53
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.

2 participants