我知道如何在使用LWP::UserAgent
时处理HTTP::Request
操作的timeout
,但是由于我需要使用HTTP::Async
模块而不是Perl模块LWP::UserAgent
,我正在寻找替代解决方案为异步http请求设置超时。
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.