>> If you are hoping to resume inline, you could simulate it with
>> something like: [...]
> This would still require a fancy session manager that could figure  
> out which request exactly to serve and how to clean up unused  
> requests...

That's not too hard, though. Just drop a cookie with a session_id (in  
unpredictable one, and maybe an IP address/user-agent, to prevent the  
most egregious session highjacking), and check the cookie when the  
next request comes in. That session presumably now has a function  
attached to it to call to get the next result in the chain.

Since a number of nested session-setups could get ugly:

session_manager:new(...
   session_manager:new(...

(especially since they'd have to be lexically in reverse-order to the  
actual execution order), you might want to set up some simple data- 
structure for chaining them:

task:new([fun say_hello/2,
          fun ask_how_are_you/2,
          fun say_fine_thanks_and_ask_about_weather/2,
          | ... ]).

(such that each is defined to, for instance, take the list of  
parameters "so far" and return an {{ewc},NewParams})

If you plan to get really busy, you'll need a hash function that takes  
some relatively (not necessarily perfectly) unique value (IP/User- 
agent?) and maps that to a given session_manager or node, so that you  
can have multiple session_managers on several nodes, for ease of load- 
balancing.

Cleaning up unused requests without blocking is a little trickier, but  
you could just, every N requests or minutes, spawn a process, passing  
it a list of
[{session_id,last_used_date} |...], then have it send back to the  
session_manager a number of session_manager:delete(Session_id) casts  
as appropriate, so that the 'delete's and actual session requests can  
be interleaved rather than totally blocking the session_manager.

It's at least conceptually solid, I think :)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to