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

Add semaphore to error store when flushing cached reports #270

Merged
merged 7 commits into from
Mar 16, 2018

Conversation

fractalwrench
Copy link
Contributor

Adds a semaphore to the ErrorStore that is used when flushing cached reports. This prevents a scenario where a report could potentially be sent multiple times.

writeFakeError();
errorStore.flushOnLaunch(apiClient);
errorStore.flushAsync(apiClient);
assertEquals(1, requestCount.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

Referring to a desk conversation: This assertion was failing inconsistently when the emulator was first launched with the error:

java.lang.AssertionError: expected:<1> but was:<0>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:631)
at com.bugsnag.android.ErrorStoreAsyncTest.testLaunchThenConnectivity(ErrorStoreAsyncTest.java:90)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

@fractalwrench
Copy link
Contributor Author

Unit test removed as this will be covered by mazerunner instead.

@coveralls
Copy link

coveralls commented Mar 15, 2018

Pull Request Test Coverage Report for Build 1245

  • 11 of 13 (84.62%) changed or added relevant lines in 1 file are covered.
  • 14 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.4%) to 70.748%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sdk/src/main/java/com/bugsnag/android/ErrorStore.java 11 13 84.62%
Files with Coverage Reduction New Missed Lines %
sdk/src/main/java/com/bugsnag/android/ErrorStore.java 1 61.04%
sdk/src/main/java/com/bugsnag/android/SessionTracker.java 13 55.64%
Totals Coverage Status
Change from base Build 1217: -0.4%
Covered Lines: 1768
Relevant Lines: 2499

💛 - Coveralls

@fractalwrench
Copy link
Contributor Author

@kattrali I have run the 3 new mazerunner scenarios against this and they pass, whereas on master they would fail.

Copy link
Contributor

@kattrali kattrali left a comment

Choose a reason for hiding this comment

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

Confirmed this works in an environment with slow network speeds and high latency.

@fractalwrench fractalwrench merged commit 58b73a8 into master Mar 16, 2018
@fractalwrench fractalwrench deleted the async-error-store-tests branch March 16, 2018 16:40
rich-bugsnag pushed a commit that referenced this pull request Sep 3, 2021
Build unity project twice to ensure -ObjC flag is set
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.

4 participants