Skip to content

Commit

Permalink
增加http请求发生前的debug日志,使得请求建连失败的也可以知道是什么请求
Browse files Browse the repository at this point in the history
  • Loading branch information
hexsum committed Apr 9, 2019
1 parent a5693e9 commit 68cb469
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Mojo/Weixin/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ sub _http_request{
$opt{ua_inactivity_timeout} = delete $_[1]->{ua_inactivity_timeout} if defined $_[1]->{ua_inactivity_timeout};
}
if(ref $_[-1] eq "CODE" and !$opt{blocking}){
$self->debug("issue request[$method] to [$_[0]]");
my $cb = pop;
return $self->ua->$method(@_,sub{
my($ua,$tx) = @_;
Expand All @@ -125,6 +126,7 @@ sub _http_request{
my $cb = pop if ref $_[-1] eq "CODE";
for(my $i=0;$i<=$opt{ua_retry_times};$i++){

$self->debug("issue request[$method] to [$_[0]]");
#fix bug Mojo::IOLoop already running Mojo/UserAgent.pm
#https://github.com/kraih/mojo/issues/1029
$self->ua->ioloop->stop if $self->ua->ioloop->is_running;
Expand Down

0 comments on commit 68cb469

Please sign in to comment.