Reputation: 43673
I know how to handle timeout
on HTTP::Request
operations when LWP::UserAgent
is used, but as I need to use HTTP::Async
module instead of the Perl module LWP::UserAgent
, I am looking for alternative solution(s) to set timeout for async http request(s).
Upvotes: 1
Views: 786
Reputation: 62109
Have you read the documentation?
To set the default timeout for requests:
# When creating the object:
my $async = HTTP::Async->new( timeout => 300 ); # 5 minutes
# Changing it later:
$async->timeout(600); # 10 minutes
To change the timeout for a single request:
$async->add_with_opts( $request, { timeout => 600 } ); # 10 minutes
Update: It seems there's a bug and the timeout
attribute doesn't actually work.
Upvotes: 3