Skip to content

Commit 02df2e6

Browse files
committed
perf: skip Klaxon parsing for empty agent attribute maps
1 parent 08a2954 commit 02df2e6

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

.changeset/sixty-radios-switch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"client-sdk-android": patch
3+
---
4+
5+
perf: Skip Klaxon parsing for empty agent attribute maps

livekit-android-sdk/src/main/java/io/livekit/android/room/types/AgentTypesExt.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ internal fun AgentAttributes.Companion.fromJsonObject(jsonObject: JsonObject) =
2828
* @suppress
2929
*/
3030
fun AgentAttributes.Companion.fromMap(map: Map<String, *>): AgentAttributes {
31+
if (map.values.all { it == null }) {
32+
return AgentAttributes()
33+
}
34+
3135
return fromJsonObject(JsonObject(map)) ?: AgentAttributes()
3236
}
3337

0 commit comments

Comments
 (0)