onStop goes on perpetually

I have used onStop() as advised here: Shiny - Run code after an application or session ends — onStop
I used the last block of advice and placed the onStop() in my global.R.
While it was executing every time as expected the problem surfaced when I no longer needed the onStop and commented portion of it (see code below). But a new shiny session still triggered the old onStop() code (even though commented). I tried to stop all sessions but still the problem prevailed. Finally I had to restart my R session on the server to get rid of the old onStop. Note: I cannot rule out a live session elsewhere, as this was being tested by a few colleagues from their home too.

Was there any easier way to stop the function than restarting R? And was I using the function at the wrong place?

Here was my onStop code, placed at the end of my global.R:

onStop(fun =
           function(){
               message("onStop triggered. No action.")
               #message("Saving new token on disk last updated on:",attr(x,"updatedon"))
    #saveRDS(object = jwt,file = "token_omni_api.RDS")
})

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.