[Backgroundrb-devel] Could a BackgrounDrb worker do this?

Bill Walton bill.walton at charter.net
Thu Sep 14 13:57:40 EDT 2006


Hi Ezra,

Ezra Zygmuntowicz wrote:
>
> I'm just not sure what you are trying to accomplish with this.

My bad.

In 'normal' session management the goal is to shut off visitor access after 
a set period of time.  Data removal is a secondary concern.

I'm working to a requirement that says "shutting off visitor access and 
removing the data they've entered from the system need to happen at the same 
time, and both need to happen when we say they're going to happen."

Sweeping the system with a cron job doesn't accomplish that.  If, for 
example, the timeout is set for 5 minutes, and the cron job runs every five 
minutes, some visitors will time out in 5 minutes and some will time out in 
9:59 minutes.

> I  think you are making it way more difficult ;)

What do you think now?  If there's an easier way, I'm dying to be educated! 
;-)

> If you really feel you need to call back to your controller from the bgdrb 
> server, you could use net/http in ruby's standard library top make a http 
> request back  to the rails app.

Now we're talkin'!!!  I'll dig into it.

> The problem with trying to talk back to rails from the drb server is that 
> rails is not persistent. Each request instantiates a new controller 
> object.

I understand.  I was hoping that if I started a DRb server from within the 
controller to listen for a call from a remote client, that Rails would 
somehow keep the controller 'alive' at some level.  I guess not.

You've given me some hope though by pointing me to the net/http library.  My 
understanding is that Rails knows what objects to use based on a session id 
that gets passed as part of the message header.  Is that right?  If it is, 
then it seems like if I send a logout message with the 'right' header, Rails 
won't know whether or not the request actually came from the visitor 
clicking the logout button.  I guess, in the end, what I'm trying to do is 
an 'authorized' session hijacking by an surrogate whose only job is to make 
sure everything gets cleaned up as required.

If I've said anything else that doesn't make sense, please feel free to 
'slap me around' a little ;-)

I'll be back, with more questions I'm sure ;-), after I've studied the 
net/http library.

Thanks!
Bill 



More information about the Backgroundrb-devel mailing list