Skip to content

Commit

Permalink
Merge pull request #2095 from bugsnag/lemnik/ManualSessionSmokeScenar…
Browse files Browse the repository at this point in the history
…io-fix

Fix ManualSessionSmokeScenario
  • Loading branch information
lemnik authored Oct 29, 2024
2 parents f5fd26b + 08fb1b5 commit 6488ddc
Showing 1 changed file with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.bugsnag.android.Configuration
import com.bugsnag.android.createDefaultDelivery
import com.bugsnag.android.mazerunner.InterceptingDelivery
import java.util.concurrent.CountDownLatch
import kotlin.concurrent.thread

/**
* Sends an exception after pausing the session
Expand All @@ -27,23 +28,25 @@ internal class ManualSessionSmokeScenario(

override fun startScenario() {
super.startScenario()
Bugsnag.setUser("123", "ABC.CBA.CA", "ManualSessionSmokeScenario")
thread {
Bugsnag.setUser("123", "ABC.CBA.CA", "ManualSessionSmokeScenario")

// send session
Bugsnag.startSession()
// send session
Bugsnag.startSession()

// send exception with session
Bugsnag.notify(generateException())
// send exception with session
Bugsnag.notify(generateException())

// send exception without session
Bugsnag.pauseSession()
Bugsnag.notify(generateException())
// send exception without session
Bugsnag.pauseSession()
Bugsnag.notify(generateException())

// override to ensure request order, as the order of fatal errors
// can be indeterminate if they are persisted to disk at the same
// millisecond as another error.
deliveryLatch.await()
Bugsnag.resumeSession()
throw generateException()
// override to ensure request order, as the order of fatal errors
// can be indeterminate if they are persisted to disk at the same
// millisecond as another error.
deliveryLatch.await()
Bugsnag.resumeSession()
throw generateException()
}
}
}

0 comments on commit 6488ddc

Please sign in to comment.