While loops

If I have this snippet of code for the main page that loads:

def index
while 1
logger.info(“hi”)
end
end

Then, I close the browser that opened that page, I notice that the
logger continues to print “hi” to the file (using tail -f). Is there a
way to stop the server from running such actions when the browser is
closed? (The logger.info was just an example. It could be anything
else)

Thanks

What is your real application? This seems weird to have a while 1 loop
in a Rails action.

On Monday, July 10, 2006, at 6:00 PM, User wrote:

logger continues to print “hi” to the file (using tail -f). Is there a
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Your loop runs on the server and really cannot detect if the browser
window is closed.

_Kevin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs