instagram-node-lib icon indicating copy to clipboard operation
instagram-node-lib copied to clipboard

instagram-node-lib not response after running for about an hours

Open songpr opened this issue 12 years ago • 0 comments

I use the lib to retrieve instagram pics of a tag=love repeatedly. After running for about an hour. The lib is not response any more, no error throw ... just do nothing.

I've solved this by setting time out to http request in class.instagram.js below,

  InstagramAPI.prototype._request = function(params) {

      ...
      request.setTimeout( 10000, function( ) {
          request.abort();
      });
      if (post_data != null) {
        request.write(post_data);
      }
      request.addListener('error', function(connectionException) {
        if (connectionException.code !== 'ENOTCONN') {
          if (appResponse != null) {
            return error(connectionException, options, "_request", appResponse);
          } else {
            return error(connectionException, options, "_request");
          }
        }
      });

songpr avatar Nov 11 '13 04:11 songpr