cloud log upload bug fix
This commit is contained in:
parent
d87ab2d8a5
commit
b8e332e9d7
|
@ -293,7 +293,7 @@ class DiaconnG8Service : DaggerService() {
|
|||
|
||||
// pump log loop size
|
||||
val pumpLogPageSize = 11
|
||||
val (start, end, loopSize) = getLogLoopCount(apsLastLogNum, apsWrappingCount, pumpLastNum, pumpWrappingCount, false)
|
||||
val (start, end, loopSize) = getLogLoopCount(apsLastLogNum, apsWrappingCount, pumpLastNum, pumpWrappingCount)
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "loopinfo start : $start, end : $end, loopSize : $loopSize")
|
||||
// log sync start!
|
||||
if (loopSize > 0) {
|
||||
|
@ -326,7 +326,7 @@ class DiaconnG8Service : DaggerService() {
|
|||
aapsLogger.debug(LTag.PUMPCOMM, "platformLogNo: $platformLogNo, platformWrappingCount: $platformWrappingCount")
|
||||
|
||||
// 페이지 사이즈로 처리할 때 루핑 횟수 계산
|
||||
val (platformStart, platformEnd, platformLoopSize) = getLogLoopCount(platformLogNo, platformWrappingCount, pumpLastNum, pumpWrappingCount, true)
|
||||
val (platformStart, platformEnd, platformLoopSize) = getCloudLogLoopCount(platformLastNo.toInt(), platformLogNo, platformWrappingCount, pumpLastNum, pumpWrappingCount)
|
||||
if(platformLoopSize > 0) {
|
||||
diaconnG8Pump.isPlatformUploadStarted = true
|
||||
for (i in 0 until platformLoopSize) {
|
||||
|
@ -347,22 +347,39 @@ class DiaconnG8Service : DaggerService() {
|
|||
return result
|
||||
}
|
||||
|
||||
private fun getLogLoopCount(lastLogNum: Int, wrappingCount: Int, pumpLastNum: Int, pumpWrappingCount: Int, isPlatform: Boolean): Triple<Int, Int, Int> {
|
||||
private fun getLogLoopCount(lastLogNum: Int, wrappingCount: Int, pumpLastNum: Int, pumpWrappingCount: Int): Triple<Int, Int, Int> {
|
||||
val start: Int// log sync start number
|
||||
val end: Int // log sync end number1311
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "lastLogNum : $lastLogNum, wrappingCount : $wrappingCount , pumpLastNum: $pumpLastNum, pumpWrappingCount : $pumpWrappingCount")
|
||||
|
||||
if ((pumpWrappingCount * 10000 + pumpLastNum - lastLogNum > 10000 && isPlatform)) {
|
||||
start = pumpLastNum
|
||||
end = 10000
|
||||
} else if (pumpWrappingCount > wrappingCount && lastLogNum < 9999) {
|
||||
if (pumpWrappingCount > wrappingCount && lastLogNum < 9999) {
|
||||
start = (lastLogNum + 1)
|
||||
end = 10000
|
||||
} else if (pumpWrappingCount > wrappingCount && lastLogNum >= 9999 && isPlatform) {
|
||||
} else {
|
||||
start = (lastLogNum + 1)
|
||||
end = pumpLastNum
|
||||
}
|
||||
val size = ceil((end - start) / 11.0).toInt()
|
||||
//
|
||||
return Triple(start, end, size)
|
||||
}
|
||||
|
||||
private fun getCloudLogLoopCount(platformLastNo:Int, PlatformPumpLogNum: Int, wrappingCount: Int, pumpLastNum: Int, pumpWrappingCount: Int): Triple<Int, Int, Int> {
|
||||
val start: Int// log sync start number
|
||||
val end: Int // log sync end number1311
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "platformLastNo: $platformLastNo, PlatformPumpLogNum : $PlatformPumpLogNum, wrappingCount : $wrappingCount , pumpLastNum: $pumpLastNum, pumpWrappingCount :$pumpWrappingCount")
|
||||
|
||||
if ((pumpWrappingCount * 10000 + pumpLastNum - platformLastNo > 10000 )) {
|
||||
start = pumpLastNum
|
||||
end = 10000
|
||||
} else if (pumpWrappingCount > wrappingCount && PlatformPumpLogNum < 9999) {
|
||||
start = (PlatformPumpLogNum + 1)
|
||||
end = 10000
|
||||
} else if (pumpWrappingCount > wrappingCount && PlatformPumpLogNum >= 9999 ) {
|
||||
start = 0 // 처음부터 시작
|
||||
end = pumpLastNum
|
||||
} else {
|
||||
start = (lastLogNum + 1)
|
||||
start = (PlatformPumpLogNum + 1)
|
||||
end = pumpLastNum
|
||||
}
|
||||
val size = ceil((end - start) / 11.0).toInt()
|
||||
|
|
Loading…
Reference in a new issue