GitOrigin-RevId: fccaf81fb8f85d3b125e4b28a1bf5b8039ae8a5f
This commit is contained in:
Vladimir Krivosheev
2023-05-23 23:24:50 +00:00
committed by intellij-monorepo-bot
parent ca4d609ddb
commit 499ba061d3
2 changed files with 6 additions and 9 deletions
@@ -26,6 +26,7 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.components.serviceAsync
import com.intellij.openapi.components.stateStore
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.diagnostic.debug
import com.intellij.openapi.diagnostic.getOrLogException
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.extensions.ExtensionPointName
@@ -467,9 +468,7 @@ private suspend fun executePreloadActivity(activity: PreloadingActivity, descrip
try {
activity.execute()
if (isDebugEnabled) {
LOG.debug("${activity.javaClass.name} finished")
}
LOG.debug { "${activity.javaClass.name} finished" }
}
catch (e: CancellationException) {
throw e
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.stats.completion.sender
import com.intellij.internal.statistic.utils.StatisticsUploadAssistant
@@ -21,19 +21,17 @@ internal fun isCompletionLogsSendAllowed(): Boolean {
return ApplicationManager.getApplication().isEAP && java.lang.Boolean.parseBoolean(System.getProperty("completion.stats.send.logs", "true"))
}
private val LOG = logger<SenderPreloadingActivity>()
@Service
private class StatsCollectorPluginDisposable : Disposable {
override fun dispose() {
}
}
internal class SenderPreloadingActivity : PreloadingActivity() {
private class SenderPreloadingActivity : PreloadingActivity() {
private val alarm = Alarm(Alarm.ThreadToUse.POOLED_THREAD, service<StatsCollectorPluginDisposable>())
private val sendInterval = 5 * Time.MINUTE
override fun preload() {
override suspend fun execute() {
val app = ApplicationManager.getApplication()
if (app.isUnitTestMode || app.isHeadlessEnvironment) {
return
@@ -50,7 +48,7 @@ internal class SenderPreloadingActivity : PreloadingActivity() {
}
try {
WebServiceStatusManager.getAllStatuses().forEachLoggingErrors(LOG) { status ->
WebServiceStatusManager.getAllStatuses().forEachLoggingErrors(logger<SenderPreloadingActivity>()) { status ->
status.update()
if (status.isServerOk()) {
service<StatisticSender>().sendStatsData(status.dataServerUrl())