Fix: wrong calculation of nextUpdate when setting custom fetchInterval (#1206)

This commit is contained in:
Cuong-Tran
2024-09-14 20:58:24 +07:00
committed by GitHub
parent d42f776c5c
commit 223af5508f

View File

@@ -107,7 +107,7 @@ class FetchInterval(
interval.absoluteValue.takeIf { interval < 0 } interval.absoluteValue.takeIf { interval < 0 }
?: increaseInterval(interval, timeSinceLatest, increaseWhenOver = 10), ?: increaseInterval(interval, timeSinceLatest, increaseWhenOver = 10),
) )
return latestDate.plusDays((cycle + 1) * interval.toLong()).toEpochSecond(dateTime.offset) * 1000 return latestDate.plusDays((cycle + 1) * interval.absoluteValue.toLong()).toEpochSecond(dateTime.offset) * 1000
} }
private fun increaseInterval(delta: Int, timeSinceLatest: Int, increaseWhenOver: Int): Int { private fun increaseInterval(delta: Int, timeSinceLatest: Int, increaseWhenOver: Int): Int {