update datasync logging tag

This commit is contained in:
Milos Kozak 2021-11-19 17:50:57 +01:00
parent 8e527a9635
commit 79fc1aad66

View file

@ -156,14 +156,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastBolusTime = dateUtil.now() //lastBolusTime = dateUtil.now()
queueCounter.bolusesRemaining = lastDbId - startId queueCounter.bolusesRemaining = lastDbId - startId
appRepository.getNextSyncElementBolus(startId).blockingGet()?.let { bolus -> appRepository.getNextSyncElementBolus(startId).blockingGet()?.let { bolus ->
aapsLogger.info(LTag.DATABASE, "Loading Bolus data Start: $startId ID: ${bolus.first.id} HistoryID: ${bolus.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Loading Bolus data Start: $startId ID: ${bolus.first.id} HistoryID: ${bolus.second.id} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
bolus.first.onlyNsIdAdded(bolus.second) -> { bolus.first.onlyNsIdAdded(bolus.second) -> {
confirmLastBolusIdIfGreater(bolus.second.id) confirmLastBolusIdIfGreater(bolus.second.id)
//lastBolusId = -1 //lastBolusId = -1
processChangedBolusesCompat() processChangedBolusesCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring Bolus. Only NS id changed ID: ${bolus.first.id} HistoryID: ${bolus.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring Bolus. Only NS id changed ID: ${bolus.first.id} HistoryID: ${bolus.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -214,14 +214,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastCarbsTime = dateUtil.now() //lastCarbsTime = dateUtil.now()
queueCounter.carbsRemaining = lastDbId - startId queueCounter.carbsRemaining = lastDbId - startId
appRepository.getNextSyncElementCarbs(startId).blockingGet()?.let { carb -> appRepository.getNextSyncElementCarbs(startId).blockingGet()?.let { carb ->
aapsLogger.info(LTag.DATABASE, "Loading Carbs data Start: $startId ID: ${carb.first.id} HistoryID: ${carb.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Loading Carbs data Start: $startId ID: ${carb.first.id} HistoryID: ${carb.second.id} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
carb.first.onlyNsIdAdded(carb.second) -> { carb.first.onlyNsIdAdded(carb.second) -> {
confirmLastCarbsIdIfGreater(carb.second.id) confirmLastCarbsIdIfGreater(carb.second.id)
//lastCarbsId = -1 //lastCarbsId = -1
processChangedCarbsCompat() processChangedCarbsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring Carbs. Only NS id changed ID: ${carb.first.id} HistoryID: ${carb.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring Carbs. Only NS id changed ID: ${carb.first.id} HistoryID: ${carb.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -272,14 +272,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastBcrTime = dateUtil.now() //lastBcrTime = dateUtil.now()
queueCounter.bcrRemaining = lastDbId - startId queueCounter.bcrRemaining = lastDbId - startId
appRepository.getNextSyncElementBolusCalculatorResult(startId).blockingGet()?.let { bolusCalculatorResult -> appRepository.getNextSyncElementBolusCalculatorResult(startId).blockingGet()?.let { bolusCalculatorResult ->
aapsLogger.info(LTag.DATABASE, "Loading BolusCalculatorResult data Start: $startId ID: ${bolusCalculatorResult.first.id} HistoryID: ${bolusCalculatorResult.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Loading BolusCalculatorResult data Start: $startId ID: ${bolusCalculatorResult.first.id} HistoryID: ${bolusCalculatorResult.second.id} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
bolusCalculatorResult.first.onlyNsIdAdded(bolusCalculatorResult.second) -> { bolusCalculatorResult.first.onlyNsIdAdded(bolusCalculatorResult.second) -> {
confirmLastBolusCalculatorResultsIdIfGreater(bolusCalculatorResult.second.id) confirmLastBolusCalculatorResultsIdIfGreater(bolusCalculatorResult.second.id)
//lastBcrId = -1 //lastBcrId = -1
processChangedBolusCalculatorResultsCompat() processChangedBolusCalculatorResultsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring BolusCalculatorResult. Only NS id changed ID: ${bolusCalculatorResult.first.id} HistoryID: ${bolusCalculatorResult.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring BolusCalculatorResult. Only NS id changed ID: ${bolusCalculatorResult.first.id} HistoryID: ${bolusCalculatorResult.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -332,14 +332,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastTtTime = dateUtil.now() //lastTtTime = dateUtil.now()
queueCounter.ttsRemaining = lastDbId - startId queueCounter.ttsRemaining = lastDbId - startId
appRepository.getNextSyncElementTemporaryTarget(startId).blockingGet()?.let { tt -> appRepository.getNextSyncElementTemporaryTarget(startId).blockingGet()?.let { tt ->
aapsLogger.info(LTag.DATABASE, "Loading TemporaryTarget data Start: $startId ID: ${tt.first.id} HistoryID: ${tt.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Loading TemporaryTarget data Start: $startId ID: ${tt.first.id} HistoryID: ${tt.second.id} ")
when { when {
// record is not valid record and we are within first sync, no need to upload // record is not valid record and we are within first sync, no need to upload
tt.first.id != tt.second.id && tt.second.id <= sp.getLong(R.string.key_ns_temporary_target_new_data_id, 0) -> { tt.first.id != tt.second.id && tt.second.id <= sp.getLong(R.string.key_ns_temporary_target_new_data_id, 0) -> {
confirmLastTempTargetsIdIfGreater(tt.second.id) confirmLastTempTargetsIdIfGreater(tt.second.id)
//lastTbrId = -1 //lastTbrId = -1
processChangedTempTargetsCompat() processChangedTempTargetsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring TemporaryTarget. Change within first sync ID: ${tt.first.id} HistoryID: ${tt.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring TemporaryTarget. Change within first sync ID: ${tt.first.id} HistoryID: ${tt.second.id} ")
return false return false
} }
// only NsId changed, no need to upload // only NsId changed, no need to upload
@ -347,7 +347,7 @@ class DataSyncSelectorImplementation @Inject constructor(
confirmLastTempTargetsIdIfGreater(tt.second.id) confirmLastTempTargetsIdIfGreater(tt.second.id)
//lastTtId = -1 //lastTtId = -1
processChangedTempTargetsCompat() processChangedTempTargetsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring TemporaryTarget. Only NS id changed ID: ${tt.first.id} HistoryID: ${tt.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring TemporaryTarget. Only NS id changed ID: ${tt.first.id} HistoryID: ${tt.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -403,14 +403,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastFoodTime = dateUtil.now() //lastFoodTime = dateUtil.now()
queueCounter.foodsRemaining = lastDbId - startId queueCounter.foodsRemaining = lastDbId - startId
appRepository.getNextSyncElementFood(startId).blockingGet()?.let { food -> appRepository.getNextSyncElementFood(startId).blockingGet()?.let { food ->
aapsLogger.info(LTag.DATABASE, "Loading Food data Start: $startId ID: ${food.first.id} HistoryID: ${food.second} ") aapsLogger.info(LTag.NSCLIENT, "Loading Food data Start: $startId ID: ${food.first.id} HistoryID: ${food.second} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
food.first.onlyNsIdAdded(food.second) -> { food.first.onlyNsIdAdded(food.second) -> {
confirmLastFoodIdIfGreater(food.second.id) confirmLastFoodIdIfGreater(food.second.id)
//lastFoodId = -1 //lastFoodId = -1
processChangedFoodsCompat() processChangedFoodsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring Food. Only NS id changed ID: ${food.first.id} HistoryID: ${food.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring Food. Only NS id changed ID: ${food.first.id} HistoryID: ${food.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -462,21 +462,21 @@ class DataSyncSelectorImplementation @Inject constructor(
queueCounter.gvsRemaining = lastDbId - startId queueCounter.gvsRemaining = lastDbId - startId
var tailCall = false var tailCall = false
appRepository.getNextSyncElementGlucoseValue(startId).blockingGet()?.let { gv -> appRepository.getNextSyncElementGlucoseValue(startId).blockingGet()?.let { gv ->
aapsLogger.info(LTag.DATABASE, "Loading GlucoseValue data ID: ${gv.first.id} HistoryID: ${gv.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Loading GlucoseValue data ID: ${gv.first.id} HistoryID: ${gv.second.id} ")
if (activePlugin.activeBgSource.shouldUploadToNs(gv.first)) { if (activePlugin.activeBgSource.shouldUploadToNs(gv.first)) {
when { when {
// record is not valid record and we are within first sync, no need to upload // record is not valid record and we are within first sync, no need to upload
gv.first.id != gv.second.id && gv.second.id <= sp.getLong(R.string.key_ns_glucose_value_new_data_id, 0) -> { gv.first.id != gv.second.id && gv.second.id <= sp.getLong(R.string.key_ns_glucose_value_new_data_id, 0) -> {
confirmLastGlucoseValueIdIfGreater(gv.second.id) confirmLastGlucoseValueIdIfGreater(gv.second.id)
//lastGvId = -1 //lastGvId = -1
aapsLogger.info(LTag.DATABASE, "Ignoring GlucoseValue. Change within first sync ID: ${gv.first.id} HistoryID: ${gv.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring GlucoseValue. Change within first sync ID: ${gv.first.id} HistoryID: ${gv.second.id} ")
tailCall = true tailCall = true
} }
// only NsId changed, no need to upload // only NsId changed, no need to upload
gv.first.onlyNsIdAdded(gv.second) -> { gv.first.onlyNsIdAdded(gv.second) -> {
confirmLastGlucoseValueIdIfGreater(gv.second.id) confirmLastGlucoseValueIdIfGreater(gv.second.id)
//lastGvId = -1 //lastGvId = -1
aapsLogger.info(LTag.DATABASE, "Ignoring GlucoseValue. Only NS id changed ID: ${gv.first.id} HistoryID: ${gv.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring GlucoseValue. Only NS id changed ID: ${gv.first.id} HistoryID: ${gv.second.id} ")
tailCall = true tailCall = true
} }
// without nsId = create new // without nsId = create new
@ -533,14 +533,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastTeTime = dateUtil.now() //lastTeTime = dateUtil.now()
queueCounter.tesRemaining = lastDbId - startId queueCounter.tesRemaining = lastDbId - startId
appRepository.getNextSyncElementTherapyEvent(startId).blockingGet()?.let { te -> appRepository.getNextSyncElementTherapyEvent(startId).blockingGet()?.let { te ->
aapsLogger.info(LTag.DATABASE, "Loading TherapyEvents data Start: $startId ID: ${te.first.id} HistoryID: ${te.second} ") aapsLogger.info(LTag.NSCLIENT, "Loading TherapyEvents data Start: $startId ID: ${te.first.id} HistoryID: ${te.second} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
te.first.onlyNsIdAdded(te.second) -> { te.first.onlyNsIdAdded(te.second) -> {
confirmLastTherapyEventIdIfGreater(te.second.id) confirmLastTherapyEventIdIfGreater(te.second.id)
//lastTeId = -1 //lastTeId = -1
processChangedTherapyEventsCompat() processChangedTherapyEventsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring TherapyEvents. Only NS id changed ID: ${te.first.id} HistoryID: ${te.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring TherapyEvents. Only NS id changed ID: ${te.first.id} HistoryID: ${te.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -590,7 +590,7 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastDsTime = dateUtil.now() //lastDsTime = dateUtil.now()
queueCounter.dssRemaining = lastDbId - startId queueCounter.dssRemaining = lastDbId - startId
appRepository.getNextSyncElementDeviceStatus(startId).blockingGet()?.let { deviceStatus -> appRepository.getNextSyncElementDeviceStatus(startId).blockingGet()?.let { deviceStatus ->
aapsLogger.info(LTag.DATABASE, "Loading DeviceStatus data Start: $startId ID: ${deviceStatus.id}") aapsLogger.info(LTag.NSCLIENT, "Loading DeviceStatus data Start: $startId ID: ${deviceStatus.id}")
when { when {
// without nsId = create new // without nsId = create new
deviceStatus.interfaceIDs.nightscoutId == null -> deviceStatus.interfaceIDs.nightscoutId == null ->
@ -633,7 +633,7 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastTbrTime = dateUtil.now() //lastTbrTime = dateUtil.now()
queueCounter.tbrsRemaining = lastDbId - startId queueCounter.tbrsRemaining = lastDbId - startId
appRepository.getNextSyncElementTemporaryBasal(startId).blockingGet()?.let { tb -> appRepository.getNextSyncElementTemporaryBasal(startId).blockingGet()?.let { tb ->
aapsLogger.info(LTag.DATABASE, "Loading TemporaryBasal data Start: $startId ID: ${tb.first.id} HistoryID: ${tb.second} ") aapsLogger.info(LTag.NSCLIENT, "Loading TemporaryBasal data Start: $startId ID: ${tb.first.id} HistoryID: ${tb.second} ")
val profile = profileFunction.getProfile(tb.first.timestamp) val profile = profileFunction.getProfile(tb.first.timestamp)
if (profile != null) { if (profile != null) {
when { when {
@ -642,7 +642,7 @@ class DataSyncSelectorImplementation @Inject constructor(
confirmLastTemporaryBasalIdIfGreater(tb.second.id) confirmLastTemporaryBasalIdIfGreater(tb.second.id)
//lastTbrId = -1 //lastTbrId = -1
processChangedTemporaryBasalsCompat() processChangedTemporaryBasalsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring TemporaryBasal. Change within first sync ID: ${tb.first.id} HistoryID: ${tb.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring TemporaryBasal. Change within first sync ID: ${tb.first.id} HistoryID: ${tb.second.id} ")
return false return false
} }
// only NsId changed, no need to upload // only NsId changed, no need to upload
@ -650,7 +650,7 @@ class DataSyncSelectorImplementation @Inject constructor(
confirmLastTemporaryBasalIdIfGreater(tb.second.id) confirmLastTemporaryBasalIdIfGreater(tb.second.id)
//lastTbrId = -1 //lastTbrId = -1
processChangedTemporaryBasalsCompat() processChangedTemporaryBasalsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring TemporaryBasal. Only NS id changed ID: ${tb.first.id} HistoryID: ${tb.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring TemporaryBasal. Only NS id changed ID: ${tb.first.id} HistoryID: ${tb.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -711,7 +711,7 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastEbTime = dateUtil.now() //lastEbTime = dateUtil.now()
queueCounter.ebsRemaining = lastDbId - startId queueCounter.ebsRemaining = lastDbId - startId
appRepository.getNextSyncElementExtendedBolus(startId).blockingGet()?.let { eb -> appRepository.getNextSyncElementExtendedBolus(startId).blockingGet()?.let { eb ->
aapsLogger.info(LTag.DATABASE, "Loading ExtendedBolus data Start: $startId ID: ${eb.first.id} HistoryID: ${eb.second} ") aapsLogger.info(LTag.NSCLIENT, "Loading ExtendedBolus data Start: $startId ID: ${eb.first.id} HistoryID: ${eb.second} ")
val profile = profileFunction.getProfile(eb.first.timestamp) val profile = profileFunction.getProfile(eb.first.timestamp)
if (profile != null) { if (profile != null) {
when { when {
@ -720,7 +720,7 @@ class DataSyncSelectorImplementation @Inject constructor(
confirmLastExtendedBolusIdIfGreater(eb.second.id) confirmLastExtendedBolusIdIfGreater(eb.second.id)
//lastTbrId = -1 //lastTbrId = -1
processChangedExtendedBolusesCompat() processChangedExtendedBolusesCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring ExtendedBolus. Change within first sync ID: ${eb.first.id} HistoryID: ${eb.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring ExtendedBolus. Change within first sync ID: ${eb.first.id} HistoryID: ${eb.second.id} ")
return false return false
} }
// only NsId changed, no need to upload // only NsId changed, no need to upload
@ -728,7 +728,7 @@ class DataSyncSelectorImplementation @Inject constructor(
confirmLastExtendedBolusIdIfGreater(eb.second.id) confirmLastExtendedBolusIdIfGreater(eb.second.id)
//lastEbId = -1 //lastEbId = -1
processChangedExtendedBolusesCompat() processChangedExtendedBolusesCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring ExtendedBolus. Only NS id changed ID: ${eb.first.id} HistoryID: ${eb.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring ExtendedBolus. Only NS id changed ID: ${eb.first.id} HistoryID: ${eb.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -788,14 +788,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastPsTime = dateUtil.now() //lastPsTime = dateUtil.now()
queueCounter.pssRemaining = lastDbId - startId queueCounter.pssRemaining = lastDbId - startId
appRepository.getNextSyncElementProfileSwitch(startId).blockingGet()?.let { ps -> appRepository.getNextSyncElementProfileSwitch(startId).blockingGet()?.let { ps ->
aapsLogger.info(LTag.DATABASE, "Loading ProfileSwitch data Start: $startId ID: ${ps.first.id} HistoryID: ${ps.second} ") aapsLogger.info(LTag.NSCLIENT, "Loading ProfileSwitch data Start: $startId ID: ${ps.first.id} HistoryID: ${ps.second} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
ps.first.onlyNsIdAdded(ps.second) -> { ps.first.onlyNsIdAdded(ps.second) -> {
confirmLastProfileSwitchIdIfGreater(ps.second.id) confirmLastProfileSwitchIdIfGreater(ps.second.id)
//lastPsId = -1 //lastPsId = -1
processChangedProfileSwitchesCompat() processChangedProfileSwitchesCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring ProfileSwitch. Only NS id changed ID: ${ps.first.id} HistoryID: ${ps.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring ProfileSwitch. Only NS id changed ID: ${ps.first.id} HistoryID: ${ps.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -845,14 +845,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastEpsTime = dateUtil.now() //lastEpsTime = dateUtil.now()
queueCounter.epssRemaining = lastDbId - startId queueCounter.epssRemaining = lastDbId - startId
appRepository.getNextSyncElementEffectiveProfileSwitch(startId).blockingGet()?.let { ps -> appRepository.getNextSyncElementEffectiveProfileSwitch(startId).blockingGet()?.let { ps ->
aapsLogger.info(LTag.DATABASE, "Loading EffectiveProfileSwitch data Start: $startId ID: ${ps.first.id} HistoryID: ${ps.second} ") aapsLogger.info(LTag.NSCLIENT, "Loading EffectiveProfileSwitch data Start: $startId ID: ${ps.first.id} HistoryID: ${ps.second} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
ps.first.onlyNsIdAdded(ps.second) -> { ps.first.onlyNsIdAdded(ps.second) -> {
confirmLastEffectiveProfileSwitchIdIfGreater(ps.second.id) confirmLastEffectiveProfileSwitchIdIfGreater(ps.second.id)
//lastEpsId = -1 //lastEpsId = -1
processChangedEffectiveProfileSwitchesCompat() processChangedEffectiveProfileSwitchesCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring EffectiveProfileSwitch. Only NS id changed ID: ${ps.first.id} HistoryID: ${ps.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring EffectiveProfileSwitch. Only NS id changed ID: ${ps.first.id} HistoryID: ${ps.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new
@ -903,14 +903,14 @@ class DataSyncSelectorImplementation @Inject constructor(
//lastOeTime = dateUtil.now() //lastOeTime = dateUtil.now()
queueCounter.oesRemaining = lastDbId - startId queueCounter.oesRemaining = lastDbId - startId
appRepository.getNextSyncElementOfflineEvent(startId).blockingGet()?.let { oe -> appRepository.getNextSyncElementOfflineEvent(startId).blockingGet()?.let { oe ->
aapsLogger.info(LTag.DATABASE, "Loading OfflineEvent data Start: $startId ID: ${oe.first.id} HistoryID: ${oe.second} ") aapsLogger.info(LTag.NSCLIENT, "Loading OfflineEvent data Start: $startId ID: ${oe.first.id} HistoryID: ${oe.second} ")
when { when {
// only NsId changed, no need to upload // only NsId changed, no need to upload
oe.first.onlyNsIdAdded(oe.second) -> { oe.first.onlyNsIdAdded(oe.second) -> {
confirmLastOfflineEventIdIfGreater(oe.second.id) confirmLastOfflineEventIdIfGreater(oe.second.id)
//lastOeId = -1 //lastOeId = -1
processChangedOfflineEventsCompat() processChangedOfflineEventsCompat()
aapsLogger.info(LTag.DATABASE, "Ignoring OfflineEvent. Only NS id changed ID: ${oe.first.id} HistoryID: ${oe.second.id} ") aapsLogger.info(LTag.NSCLIENT, "Ignoring OfflineEvent. Only NS id changed ID: ${oe.first.id} HistoryID: ${oe.second.id} ")
return false return false
} }
// without nsId = create new // without nsId = create new