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

Projects
None yet
4 participants
@fractalwrench
Copy link
Contributor

commented Mar 14, 2018

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.

@fractalwrench fractalwrench requested a review from kattrali Mar 14, 2018

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

This comment has been minimized.

Copy link
@Cawllec

Cawllec Mar 14, 2018

Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2018

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

@coveralls

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Contributor Author

commented Mar 16, 2018

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

@kattrali
Copy link
Member

left a comment

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

@fractalwrench fractalwrench merged commit 58b73a8 into master Mar 16, 2018

2 of 3 checks passed

coverage/coveralls Coverage decreased (-0.4%) to 70.748%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@fractalwrench fractalwrench deleted the async-error-store-tests branch Mar 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.