首页 > 解决方案 > 闪亮的 checkFunc 没有触发 valueFunc

问题描述

我正在构建一个仪表板以留在电视上。不需要用户会话,部署将在私有服务器(不是 shiny.io)上。主要想法是仪表板每 15 秒更新一次。

我的问题出在服务器功能上,实际上是 atcheckFunvalueFuncof reactivePoll()。这是我所做的:

如果返回和 previouscheckUpdateData()之间的差异,则调用of ,对吗?decFatdecFatvalueFuncreactivePoll()

server <- function(input, output, session) {

  pollData <- reactivePoll(
            intervalMillis = 15000,
            session = NULL,
            
            checkFunc = function() {
              checkUpdateData(ambiente = pAmbiente)
            },
            
            valueFunc = function() {

              etl(listObj = getData(ambiente = pAmbiente,
                                    dataI    = pDataI,
                                    dataF    = pDataF))  
        
              print("************************ check")

            }
          )

  output$dataReq <- renderTable({ pollData() })

  output$tabela <- renderDataTable({
    DT::datatable(dataReq$tbRepresent %>%
                    filter(Mes == format(Sys.Date(), format="%m")) %>%
                    select(" " = emoji, "Rep" = Representante, "Fat" = Faturamento2, "Região" = Regiao, "% Met Bat." = percMetaBatida, "% Fat" = percFaturamento),
                  options = list(pageLength = 20, dom = ''), rownames = FALSE)
  })

  output$updateTime <- renderText(dataReq$updateTime$children[[1]] %>%
                                    as.character() %>%
                                    stringr::str_replace_all(., "\n", "") %>%
                                    stringr::str_replace_all(., "   ", " "))

}

print("***check")运行时从未打印过。App运行时的日志下方:

Listening on http://127.0.0.1:567
13/11/2020 10:37:08
Last decFat: 9209947.53363352 | Previous decFat: 430074.858996368
13/11/2020 10:37:08
Last decFat: 9213301.07789995 | Previous decFat: 430074.858996368
13/11/2020 10:37:24
Last decFat: 9206235.81931037 | Previous decFat: 430074.858996368

我不知道如何强制dataReq更新自己。任何想法将不胜感激。

提前谢谢。

标签: rshiny

解决方案


推荐阅读