Re: How to get rid of the delay after the real work is done?

Rocco Caputo <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
That's probably the keep-alive timer in POE::Component::Client::HTTP.   
You can preemptively shutdown the client when you know you won't need  
it anymore.

Starting and stopping POE involves some setup & cleanup overhead.  I'm  
not sure if the overhead will exceed your expectations.  If it does, I  
have a POE::Component::Client::HTTP wrapper that avoids the stop/ 
restart and provides a different API.  Experimental, unreleased code,  
no warranties, same-terms-as-perl, etc.:

http://poe.dyndns.org/~troc/tmp/pua.pl
http://poe.dyndns.org/~troc/tmp/pua-defer.pl

-- 
Rocco Caputo - [email protected]

On Jun 19, 2009, at 05:29, Michael Lackhoff wrote:

> I am totally new to POE, so this might be a silly question but I  
> looked
> at the mailing list archive and the FAQ and didn't find the answer.
>
> What I want to do is a parallel web client. For this I found a good
> recipe in the POE cookbook http://poe.perl.org/?POE_Cookbook/ 
> Web_Client
> The first example looked exactly like what I was looking for so I  
> copied
> the code and only added a few more URLs to @url_list.
> Everything went fine, I got the web pages very fast but then after the
> real work was done (all pages displayed) I had to wait for another 5
> seconds until the script ended.
> When I did this with the real pages I want to get (some JSON results)
> and a bit of Time::HiRes output the relation was 4 seconds for the
> actual work and then the 5 seconds delay until I could proceed.
> If I could speed this up to the 4 seconds needed for the actual work,
> everything would be fine and so much better than 9 seconds. How can I
> achieve this?
>
> Eventually I want to wrap this script into a method of my application,
> call it with a list of URLs and return the combined result. The
> application is a mod_perl web app. Are there any issues with this  
> setup
> I should watch out for?
>
> Thanks
> -Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.