Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit f45c18c

Browse files
committed
Use Iterator to stream the gui files
Stream holds a copy of each read element in memory, which we don't need or use afterwards. Instead we should use Iterator to actually stream the gui files to the user and reduce memory consumption.
1 parent 2e6afdd commit f45c18c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/scala/org/codeoverflow/chatoverflow/ui/web/GUIServlet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class GUIServlet extends ScalatraServlet with WithLogger {
5252
val is = new BufferedInputStream(jarFile.getInputStream(entry))
5353
val os = response.getOutputStream
5454

55-
Stream.continually(is.read)
55+
Iterator.continually(is.read)
5656
.takeWhile(_ != -1)
5757
.foreach(os.write)
5858
}

0 commit comments

Comments
 (0)