Skip to content

Commit 290ac6e

Browse files
authored
Merge pull request #2601 from digma-ai/stop-reporting-AutoRefreshStatistics-event
stop-reporting-AutoRefreshStatistics-event
2 parents fe2e450 + 5307f68 commit 290ac6e

File tree

1 file changed

+9
-7
lines changed
  • ide-common/src/main/kotlin/org/digma/intellij/plugin/auth

1 file changed

+9
-7
lines changed

ide-common/src/main/kotlin/org/digma/intellij/plugin/auth/AuthManager.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ class AuthManager(private val cs: CoroutineScope) : Disposable {
560560
val timeSinceLastStatistics = (now - statisticsStartTime).inWholeMilliseconds.toDuration(DurationUnit.MILLISECONDS)
561561

562562
//detect too many refresh in a short time. in correct functioning there should never be more than 5 refresh in 1 hour
563-
if (refreshCounter > 5 && timeSinceLastStatistics < 1.hours) {
563+
if (refreshCounter > 5 && timeSinceLastStatistics <= 1.hours) {
564564
ErrorReporter.getInstance().reportError(
565565
"AuthManager.autoRefreshJob", "too many refresh", mapOf(
566566
"period.minutes" to timeSinceLastStatistics.inWholeMinutes,
@@ -571,13 +571,15 @@ class AuthManager(private val cs: CoroutineScope) : Disposable {
571571

572572
//send statistics approximately every 1 hour , this will help detect incorrect functioning on this job.
573573
if (timeSinceLastStatistics >= 1.hours) {
574-
statisticsStartTime = now
575-
reportAuthPosthogEvent(
576-
"AutoRefreshStatistics", "AutoRefreshJob", null, mapOf(
577-
"period.minutes" to timeSinceLastStatistics.inWholeMinutes,
578-
"refresh.counter" to refreshCounter
574+
withAuthManagerDebug {
575+
reportAuthPosthogEvent(
576+
"AutoRefreshStatistics", "AutoRefreshJob", null, mapOf(
577+
"period.minutes" to timeSinceLastStatistics.inWholeMinutes,
578+
"refresh.counter" to refreshCounter
579+
)
579580
)
580-
)
581+
}
582+
statisticsStartTime = now
581583
refreshCounter = 0
582584
}
583585

0 commit comments

Comments
 (0)