Skip to content

Commit 6ce298c

Browse files
committed
Use foreachL instead of .consumeWith
1 parent 63fdb69 commit 6ce298c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rest/.jvm/src/main/scala/io/udash/rest/RestServlet.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ class RestServlet(
150150
case binary: StreamedBody.RawBinary =>
151151
response.setContentType(binary.contentType)
152152
binary.content
153-
.consumeWith(Consumer.foreach { chunk =>
153+
.foreachL { chunk =>
154154
response.getOutputStream.write(chunk)
155155
response.getOutputStream.flush()
156-
})
156+
}
157157
case jsonList: StreamedBody.JsonList =>
158158
response.setContentType(jsonList.contentType)
159159
jsonList.elements
160160
.bufferTumbling(jsonList.customBatchSize.getOrElse(defaultStreamingBatchSize))
161161
.switchIfEmpty(Observable(Seq.empty))
162162
.zipWithIndex
163-
.consumeWith(Consumer.foreach { case (batch, idx) =>
163+
.foreachL { case (batch, idx) =>
164164
val firstBatch = idx == 0
165165
if (firstBatch) {
166166
response.getOutputStream.write("[".getBytes(jsonList.charset))
@@ -176,7 +176,7 @@ class RestServlet(
176176
response.getOutputStream.write(e.value.getBytes(jsonList.charset))
177177
}
178178
response.getOutputStream.flush()
179-
})
179+
}
180180
.map(_ => response.getOutputStream.write("]".getBytes(jsonList.charset)))
181181
}
182182
}.onErrorHandle {

0 commit comments

Comments
 (0)