Update

**************

I don't the underlying cause. I fixed the issue on my program by using REST::Client instead of LWP::UserAgent....details of the code are in one of my reply below

***************

My Get request is timing out after processing 20 or 30 request...I have over 500 records to process. I did confirm that there is no limit on number of GET requested placed to API. I also tried using chrom extension postman to repeatably place GET request successfully. Yet when I place GET request though my perl program it failed after processing few requests. Any help is greatly appreciated

error says following:

500 can't connect to api.xxx.com:443. (A connection attempt failed because the connected party did not properly respond after a periold of time, or established connection failed because connected host has failed to respond

LWP::Protoclo::https::Socket: connect: a connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at C:/Dwimperl/perl/site/LWP/Protocol/http.pm"

my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 }, ); $ua->timeout('1000'); sub getUserInfo { my($userId) = @_; my $partnerId = 'B53765B23456678C1' my $userURI = 'https://xxx.com/api/m1/request/'. $partnerId. '/users/ +'. $userId; print $userURI, "\n"; #sleep (3); my $userResponse = $ua -> request(GET($userURI, Authorization => $aut +hHeaders)); # I am getting a token which is passed in the header. if ($userResponse->is_success) { my $userRecord = decode_json($userResponse->content); print $userResponse->status_line, "\n"; return ($userRecord); } else { displayMsg ( "No user Records to process...................."); print $userResponse->status_line, "\n"; print $userResponse->decoded_content, "\n"; error ("Error: ", $userResponse->status_line, " " , $userResponse- +>decoded_content); exit 1; } }

In reply to LWP::UserAgent Get timing out after few request by sannag

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.