@@ -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