Skip to content

Commit edccd1c

Browse files
committed
Looking for issues with buffering.
1 parent aeabd59 commit edccd1c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/kotlin/docker/DockerProxy.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ abstract class DockerProxy(configuration: Configuration) : MigrationStrategy(con
9393
private fun listenForDockerStatistics() {
9494
println("Started a docker stats process")
9595
val numberOfElements = (configuration.slotDuration / 1000).toInt()
96-
96+
val json = Json { ignoreUnknownKeys = true }
9797
while (true) {
9898
// TODO: I believe this could be optimised
9999
val process = ProcessBuilder()
@@ -103,7 +103,7 @@ abstract class DockerProxy(configuration: Configuration) : MigrationStrategy(con
103103
val reader = process.inputStream.bufferedReader()
104104

105105
reader.readLines().forEach { line ->
106-
val stats = Json.decodeFromString<DockerStatsModel>(line)
106+
val stats = json.decodeFromString<DockerStatsModel>(line)
107107
val pids = stats.pids.toIntOrNull() ?: 0
108108
val cpuPercentage = stats.cpuPercentage.trim('%').toDoubleOrNull() ?: 0.0
109109
val memoryPercentage = stats.memoryPercentage.trim('%').toDoubleOrNull() ?: 0.0

0 commit comments

Comments
 (0)