Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Use common-utils from maven, use withContext instead runBlocking (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
skkosuri-amzn authored Oct 16, 2020
1 parent 1d0e8ff commit 043ba5c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ import com.amazon.opendistroforelasticsearch.alerting.settings.DestinationSettin
import com.amazon.opendistroforelasticsearch.alerting.settings.DestinationSettings.Companion.loadDestinationSettings
import com.amazon.opendistroforelasticsearch.alerting.util.IndexUtils
import com.amazon.opendistroforelasticsearch.alerting.util.isAllowed
import org.apache.logging.log4j.LogManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import org.apache.logging.log4j.LogManager
import org.elasticsearch.ExceptionsHelper
import org.elasticsearch.action.DocWriteRequest
import org.elasticsearch.action.bulk.BackoffPolicy
Expand Down Expand Up @@ -224,7 +223,7 @@ class MonitorRunner(
logger.error("Error loading alerts for monitor: $id", e)
return monitorResult.copy(error = e)
}
runBlocking(InjectorContextElement(monitor.id, settings, threadPool.threadContext, roles)) {
withContext(InjectorContextElement(monitor.id, settings, threadPool.threadContext, roles)) {
monitorResult = monitorResult.copy(inputResults = collectInputResults(monitor, periodStart, periodEnd))
}
val updatedAlerts = mutableListOf<Alert>()
Expand Down
5 changes: 1 addition & 4 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ dependencies {
compile "com.cronutils:cron-utils:7.0.5"
compile "org.elasticsearch.client:elasticsearch-rest-client:${es_version}"
compile 'com.google.googlejavaformat:google-java-format:1.3'
compile "com.amazon.opendistroforelasticsearch:common-utils:${opendistroVersion}.0"

testImplementation "org.elasticsearch.test:framework:${es_version}"
testImplementation "org.jetbrains.kotlin:kotlin-test:${kotlin_version}"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${kotlin_version}"


//fixme: pick it from maven, pending on https://github.com/opendistro-for-elasticsearch/common-utils/pull/3
compile files('libs/common-utils-1.10.1.0.jar')
}
Binary file removed core/libs/common-utils-1.10.1.0.jar
Binary file not shown.

0 comments on commit 043ba5c

Please sign in to comment.