Skip to content

Commit 2a390e8

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

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/kotlin/docker/DockerProxy.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ 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-
val json = Json { ignoreUnknownKeys = true }
96+
val json = Json {
97+
ignoreUnknownKeys = true
98+
}
9799
while (true) {
98100
// TODO: I believe this could be optimised
99101
val process = ProcessBuilder()
@@ -103,6 +105,7 @@ abstract class DockerProxy(configuration: Configuration) : MigrationStrategy(con
103105
val reader = process.inputStream.bufferedReader()
104106

105107
reader.readLines().forEach { line ->
108+
println(line)
106109
val stats = json.decodeFromString<DockerStatsModel>(line)
107110
val pids = stats.pids.toIntOrNull() ?: 0
108111
val cpuPercentage = stats.cpuPercentage.trim('%').toDoubleOrNull() ?: 0.0

0 commit comments

Comments
 (0)