ruby - How to stop action execution with another action in rails? -


i have following actions in test controller:

def run   while true     # code   end end  def stop   # stop run action end 

how can stop action implemented halt run action?

because client wait response server, can't have loop in endpoint waits endpoint called.

in case, client visit /test/run, since server won't return until loop finishes, client keep waiting.

this means (unless configured webserver so), connection can't made server reach test/stop endpoint.

if must have "job" runs , cancel-able endpoint, turn actual background task.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -