in src/main/kotlin/rules_intellij/indexing/IndexingService.kt [50:74]
override fun start(request: StartupRequest, responseObserver: StreamObserver<StartupResponse>) {
val onError = { e: Throwable ->
ConsoleLog.info("Indexing Server Startup Exception: $e\n${e.stackTraceToString()}")
responseObserver.onError(statusFromThrowable(e))
}
try {
ConsoleLog.info("Indexing Server: StartupRequest: $request")
val projectPathHash = StringHash.calc(request.projectDir)
val deferredResponse = synchronized(this) {
deferredStarts.getOrPut(projectPathHash) {
ioScope.async { start(request) }
}
}
ioScope.launch {
try {
val response = deferredResponse.await()
ConsoleLog.info("Indexing Server: StartupResponse: $response")
responseObserver.onNext(response)
responseObserver.onCompleted()
} catch (e: Throwable) { onError(e) }
}
} catch (e: Throwable) { onError(e) }
}