Skip to content

Commit

Permalink
Prebuild eventbus index to speed up messages delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
fo2rist committed Oct 29, 2021
1 parent 17211b3 commit 173d93c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ apply from: '../jacoco.gradle'

buildscript { //for crashlytics
repositories {

}

dependencies {

}
}

Expand Down Expand Up @@ -40,11 +38,14 @@ android {

defaultConfig {
applicationId "com.github.fo2rist.mclaren"

targetSdkVersion project.TARGET_SDK_VERSION
minSdkVersion project.MIN_SDK_VERSION
versionCode project.APP_VERSION_CODE
versionName project.APP_VERSION_NAME

vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -137,6 +138,7 @@ dependencies {

// event bus
implementation 'org.greenrobot:eventbus:3.2.0'
kapt 'org.greenrobot:eventbus-annotation-processor:3.2.0' // for compile time discovery

// joda time
implementation 'joda-time:joda-time:2.10.3'
Expand Down Expand Up @@ -178,6 +180,12 @@ dependencies {
androidTestImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'
}

kapt {
arguments {
arg('eventBusIndex', 'com.github.fo2rist.mclaren.AutogeneratedEventBusIndex')
}
}

/**
* Load bunc of properties from file.
* @return {@link Properties}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import javax.inject.Singleton
@Singleton
class RepositoryEventBusImpl @Inject constructor() : FeedRepositoryEventBus, TransmissionRepositoryEventBus {

init {
EventBus.builder()
.addIndex(com.github.fo2rist.mclaren.AutogeneratedEventBusIndex())
.build()
}

override fun subscribe(subscriber: Any) = EventBus.getDefault().register(subscriber)

override fun unsubscribe(subscriber: Any) = EventBus.getDefault().unregister(subscriber)
Expand Down

0 comments on commit 173d93c

Please sign in to comment.