@@ -29,7 +29,7 @@ import com.duckduckgo.app.statistics.pixels.Pixel.PixelParameter.FAILURE_COUNT
2929import com.duckduckgo.app.statistics.pixels.Pixel.PixelParameter.TOTAL_COUNT
3030import com.duckduckgo.app.statistics.store.StatisticsDataStore
3131import io.reactivex.Completable
32- import io.reactivex.Completable.fromAction
32+ import io.reactivex.Completable.*
3333import timber.log.Timber
3434import java.io.IOException
3535import javax.inject.Inject
@@ -114,20 +114,21 @@ class HttpsUpgradeDataDownloader @Inject constructor(
114114 }
115115
116116 fun reportUpgradeStatistics (): Completable {
117- return fromAction {
117+ return defer {
118118
119119 if (statisticsDataStore.httpsUpgradesTotal == 0 ) {
120- return @fromAction
120+ return @defer complete()
121121 }
122122 val params = mapOf (
123123 TOTAL_COUNT to statisticsDataStore.httpsUpgradesTotal.toString(),
124124 FAILURE_COUNT to statisticsDataStore.httpsUpgradesFailures.toString()
125125 )
126126
127- pixel.fireCompletable(Pixel .PixelName .HTTPS_UPGRADE_SITE_SUMMARY , params).blockingGet()
128- Timber .v(" Sent https statistics" )
129- statisticsDataStore.httpsUpgradesTotal = 0
130- statisticsDataStore.httpsUpgradesFailures = 0
127+ pixel.fireCompletable(Pixel .PixelName .HTTPS_UPGRADE_SITE_SUMMARY , params).andThen {
128+ Timber .v(" Sent https statistics" )
129+ statisticsDataStore.httpsUpgradesTotal = 0
130+ statisticsDataStore.httpsUpgradesFailures = 0
131+ }
131132 }
132133 }
133134
0 commit comments