diff --git a/NEWS.md b/NEWS.md index 67036f4a..0c24b538 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +httpuv 1.5.2.9000 +================= + +* Avoid creating a new Rook error stream object for each request. This should improve performance. ([#245](https://github.com/rstudio/httpuv/pull/245)) + httpuv 1.5.2 ============ diff --git a/R/httpuv.R b/R/httpuv.R index ff0f2f90..1eeb2178 100644 --- a/R/httpuv.R +++ b/R/httpuv.R @@ -88,6 +88,7 @@ ErrorStream <- R6Class( ), cloneable = FALSE ) +stdErrStream <- ErrorStream$new() #' @importFrom promises promise then finally is.promise %...>% %...!% rookCall <- function(func, req, data = NULL, dataLength = -1) { @@ -102,7 +103,7 @@ rookCall <- function(func, req, data = NULL, dataLength = -1) { req$rook.input <- inputStream - req$rook.errors <- ErrorStream$new() + req$rook.errors <- stdErrStream req$httpuv.version <- httpuv_version()