Skip to content

Commit

Permalink
Merge pull request rstudio#208 from trestletech/master
Browse files Browse the repository at this point in the history
Add reactive timing logging, if the necessary variables are available.
  • Loading branch information
jcheng5 committed Aug 22, 2013
2 parents 1a6901c + 05a9204 commit c304889
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion R/shiny.R
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,21 @@ startApp <- function(httpHandlers, serverFuncSource, port, workerId) {
shinysession$dispatch(msg)
)
shinysession$manageHiddenOutputs()
if (exists(".shiny__stdout") && exists("HTTP_GUID", env=ws$request)){
# safe to assume we're in shiny-server, eNter a flushReact
writeLines(paste("_n_flushReact ", get("HTTP_GUID", env=ws$request),
" @ ", sprintf("%.3f", as.numeric(Sys.time())),
sep=""), con=.shiny__stdout)
flush(.shiny__stdout)
}
flushReact()
if (exists(".shiny__stdout") && exists("HTTP_GUID", env=ws$request)){
# safe to assume we're in shiny-server, eXit a flushReact
writeLines(paste("_x_flushReact ", get("HTTP_GUID", env=ws$request),
" @ ", sprintf("%.3f", as.numeric(Sys.time())),
sep=""), con=.shiny__stdout)
flush(.shiny__stdout)
}
lapply(appsByToken$values(), function(shinysession) {
shinysession$flushOutput()
NULL
Expand Down Expand Up @@ -1283,7 +1297,7 @@ runApp <- function(appDir=getwd(),
}

require(shiny)

if (is.character(appDir)) {
orig.wd <- getwd()
setwd(appDir)
Expand Down

0 comments on commit c304889

Please sign in to comment.