Can I suggest a specific use case where this would be helpful?  I'm 
designing a tool right now where users submit a search, this spawns a 
number of concurrent backend processes which assemble output, and then as 
each piece of output is ready, it is sent to the client to update the 
results page.  So my architecture looks something like:

1. Request received from client, given a unique ID, and a copy for each 
required output is put on the 'queued requests' tube
2. Workers take those requests, run the necessary process, and put the 
output on the 'search_12345' tube, where 12345 is the unique ID of the 
search
3. The client has meanwhile made a long-poll request to the search which 
sits waiting for stuff to appear on the search_12345 tube, and when it 
appears, takes it and outputs it to the client

This plan works well because although the various parts of the output may 
be ready in an unpredictable order, the client only needs one long poll 
connection (at a time) to get the output from any of them.  The problem 
arises when a client sends the initial search result, but doesn't follow up 
with the long poll request to get the deferred outputs.  In that case, the 
outputs are still produced, but they sit in the search-specific tube for 
ever.

If they were able to time out, then the system would be self-cleaning.  But 
as it stands, I don't think there's an easy solution, because I don't think 
it's possible to watch a tube without knowing its name.  My current 
solution is a cron job that does list-tubes, makes a list of all those that 
match the pattern 'search_XXXXX', and watches all of them, so it can make 
an inspection of all the jobs in the queues and delete any that are more 
than 10 mins old, while releasing any that are still within their timeout.

A TTL on the job would make this use case far easier, I would think.

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"beanstalk-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/beanstalk-talk/-/HA33LI3jdEMJ.
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/beanstalk-talk?hl=en.

Reply via email to