Long running reactives

In the next code we are invalidating the result before ending a log process which ends in an infinitive invalidation loop.

x <- reactive({

  # Invalidation
  invalidateLater(500)
  
  # Long Process
  Sys.sleep(1)
  
  # Output
  10
})

But if we wrap the invalidation function into an on.exit function, we will make sure to run check after ending the process.

x <- reactive({

  # Invalidation
  on.exit(invalidateLater(500), add = TRUE)
  
  # Long Process
  Sys.sleep(1)
  
  # Output
  10
})