Skip to content

Commit

Permalink
SimpleAnalytics: Inject proper dependency
Browse files Browse the repository at this point in the history
Signed-off-by: Till Kottmann <me@deletescape.ch>
  • Loading branch information
nyancrimew committed Nov 28, 2019
1 parent 53ec741 commit 2ebc125
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/src/dog/del/app/stats/SimpleAnalyticsReporter.kt
Expand Up @@ -3,6 +3,7 @@ package dog.del.app.stats
import com.github.benmanes.caffeine.cache.Caffeine import com.github.benmanes.caffeine.cache.Caffeine
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import dog.del.app.config.AppConfig import dog.del.app.config.AppConfig
import dog.del.app.metrics.DogbinMetrics
import dog.del.app.utils.* import dog.del.app.utils.*
import dog.del.commons.date import dog.del.commons.date
import dog.del.commons.format import dog.del.commons.format
Expand Down Expand Up @@ -30,7 +31,7 @@ class SimpleAnalyticsReporter : StatisticsReporter, KoinComponent {
private val db by inject<TransientEntityStore>() private val db by inject<TransientEntityStore>()
private val log by inject<Logger>() private val log by inject<Logger>()
private val config by inject<AppConfig>() private val config by inject<AppConfig>()
private val cacheMetrics by inject<CacheMetricsCollector>() private val metrics by inject<DogbinMetrics>()
private val job = SupervisorJob() private val job = SupervisorJob()
private val scope = CoroutineScope(Dispatchers.IO + job) private val scope = CoroutineScope(Dispatchers.IO + job)
private val timezoneCache = Caffeine.newBuilder() private val timezoneCache = Caffeine.newBuilder()
Expand All @@ -41,7 +42,7 @@ class SimpleAnalyticsReporter : StatisticsReporter, KoinComponent {
getTimezone(slug) getTimezone(slug)
} }
}.also { }.also {
cacheMetrics.addCache("analyticsTimezoneCache", it) metrics.cacheMetrics.addCache("analyticsTimezoneCache", it)
} }
private val impressionsCache = Caffeine.newBuilder() private val impressionsCache = Caffeine.newBuilder()
.maximumSize(100) .maximumSize(100)
Expand All @@ -51,7 +52,7 @@ class SimpleAnalyticsReporter : StatisticsReporter, KoinComponent {
getSaViewCount(slug) getSaViewCount(slug)
} }
}.also { }.also {
cacheMetrics.addCache("analyticsImpressionsCache", it) metrics.cacheMetrics.addCache("analyticsImpressionsCache", it)
} }


override val embedCode = """ override val embedCode = """
Expand Down

0 comments on commit 2ebc125

Please sign in to comment.