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 -- Posted via http://www.ruby-forum.com/.
What is your real application? This seems weird to have a while 1 loop in a Rails action. On 7/10/06, User <user@user.com> wrote:> 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Monday, July 10, 2006, at 6:00 PM, User wrote:>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 > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsYour loop runs on the server and really cannot detect if the browser window is closed. _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.