Fixing aggregation and adding debug logs

This commit is contained in:
Maxime NATUREL 2022-05-02 12:24:30 +02:00
parent 0f415a56dd
commit 11ebab094b
2 changed files with 8 additions and 15 deletions

View File

@ -189,13 +189,8 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
handleEndPoll(realm, event, it, roomId, isLocalEcho) handleEndPoll(realm, event, it, roomId, isLocalEcho)
} }
} }
in EventType.STATE_ROOM_BEACON_INFO -> {
event.content.toModel<MessageBeaconInfoContent>(catchError = true)?.let {
liveLocationAggregationProcessor.handleBeaconInfo(realm, event, it, roomId, isLocalEcho)
}
}
in EventType.BEACON_LOCATION_DATA -> { in EventType.BEACON_LOCATION_DATA -> {
event.content.toModel<MessageBeaconLocationDataContent>(catchError = true)?.let { event.getClearContent().toModel<MessageBeaconLocationDataContent>(catchError = true)?.let {
liveLocationAggregationProcessor.handleBeaconLocationData(realm, event, it, roomId, isLocalEcho) liveLocationAggregationProcessor.handleBeaconLocationData(realm, event, it, roomId, isLocalEcho)
} }
} }
@ -262,11 +257,6 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
liveLocationAggregationProcessor.handleBeaconInfo(realm, event, it, roomId, isLocalEcho) liveLocationAggregationProcessor.handleBeaconInfo(realm, event, it, roomId, isLocalEcho)
} }
} }
in EventType.BEACON_LOCATION_DATA -> {
event.content.toModel<MessageBeaconLocationDataContent>(catchError = true)?.let {
liveLocationAggregationProcessor.handleBeaconLocationData(realm, event, it, roomId, isLocalEcho)
}
}
else -> Timber.v("UnHandled event ${event.eventId}") else -> Timber.v("UnHandled event ${event.eventId}")
} }
} catch (t: Throwable) { } catch (t: Throwable) {

View File

@ -54,6 +54,8 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
eventId = targetEventId eventId = targetEventId
) )
Timber.d("updating summary of id=$targetEventId with isLive=${content.isLive}")
aggregatedSummary.endOfLiveTimestampAsMilliseconds = content.getBestTimestampMillis()?.let { it + (content.timeout ?: 0) } aggregatedSummary.endOfLiveTimestampAsMilliseconds = content.getBestTimestampMillis()?.let { it + (content.timeout ?: 0) }
aggregatedSummary.isActive = content.isLive aggregatedSummary.isActive = content.isLive
} }
@ -83,6 +85,7 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
?: 0 ?: 0
if (updatedLocationTimestamp.isMoreRecentThan(currentLocationTimestamp)) { if (updatedLocationTimestamp.isMoreRecentThan(currentLocationTimestamp)) {
Timber.d("set last location of summary with id=$targetEventId to ${content.getBestLocationInfo()}")
aggregatedSummary.lastLocationContent = ContentMapper.map(content.toContent()) aggregatedSummary.lastLocationContent = ContentMapper.map(content.toContent())
} }
} }