From: Ezra Zygmuntowicz Date: 2006-07-26T02:12:01+09:00 Subject: Re: druby - How to close connection from client? On Jul 25, 2006, at 1:25 AM, Martin Boese wrote: > I need to disconnect explicitly from a druby client. > > My code is like: > > DRb.start_service > @drb = DRbObject.new(nil, 'druby://localhost:7777') > @drb.dosomething(param1, param2, param3) > ...(here I'd like to disconnect!!)... > > > Background: > I am using druby to communicate between a Rails application running on > lighttpd/FreeBSD6 and a server-script running on the same box with > different > user rights. > > I noticed that the longer I run the webserver the more sockets stay > open, > "sockstat | grep ruby" gives me hundreds of: > >> www ruby18 26179 10 tcp4 *:51359 *:* >> www ruby18 26179 11 tcp4 *:57690 *:* >> www ruby18 26179 12 tcp4 *:53473 *:* > > I assume that every time I run the druby client on the website a > connection > remains open. They get all cleared if I restart lighttpd. > > Thanks. > martin > > He Martin- You may want to have a look at a rails plugin I wrote called BackgrounDRb [1]. Its built for this exact purpose. You can have worker classes that run in the drb server that you can start and stop from rails. It also has hooks and examples of how to create ajax progress bars while your workers do their task. Cheers- -Ezra [1] http://backgroundrb.rubyforge.org/