lib/services/large_result_set.js
function callback(err, response, body)
    {
      if (err)
      {
        // if we haven't exceeded the maximum number of retries yet and the
        // server came back with a retryable error code.
        if (numRetries < maxNumRetries && isRetryableError(response, err))
        {
          // increment the number of retries
          numRetries++;

          // use exponential backoff with decorrelated jitter to compute the
          // next sleep time:
          var cap = connectionConfig.getRetryLargeResultSetMaxSleepTime();
          sleep = Util.nextSleepTime(1, cap, sleep);

          // wait the appropriate amount of time before retrying the request
          setTimeout(sendRequest, sleep * 1000);
        }
        else
        {
          // wrap the error into a network error
          err = Errors.createNetworkError(
            ErrorCodes.ERR_LARGE_RESULT_SET_NETWORK_COULD_NOT_CONNECT, err);
        }
      }
      // if the response contains xml, build an S3/Blob error from the response
      else if (response.getResponseHeader('Content-Type') ===
        'application/xml')
      {
        err = Errors.createLargeResultSetError(
          ErrorCodes.ERR_LARGE_RESULT_SET_RESPONSE_FAILURE, response);
      }

      // if we have an error, clear the body
      if (err)
      {
        body = null;
      }

      // if a callback was specified, invoke it
      if (Util.isFunction(options.callback))
      {
        options.callback(err, body);
      }
    }
function callback(err, response, body)
    {
      if (err)
      {
        // if we haven't exceeded the maximum number of retries yet and the
        // server came back with a retryable error code.
        if (numRetries < maxNumRetries && isRetryableError(response, err))
        {
          // increment the number of retries
          numRetries++;

          // use exponential backoff with decorrelated jitter to compute the
          // next sleep time:
          var cap = connectionConfig.getRetryLargeResultSetMaxSleepTime();
          sleep = Util.nextSleepTime(1, cap, sleep);

          // wait the appropriate amount of time before retrying the request
          setTimeout(sendRequest, sleep * 1000);
        }
        else
        {
          // wrap the error into a network error
          err = Errors.createNetworkError(
            ErrorCodes.ERR_LARGE_RESULT_SET_NETWORK_COULD_NOT_CONNECT, err);
        }
      }
      // if the response contains xml, build an S3/Blob error from the response
      else if (response.getResponseHeader('Content-Type') ===
        'application/xml')
      {
        err = Errors.createLargeResultSetError(
          ErrorCodes.ERR_LARGE_RESULT_SET_RESPONSE_FAILURE, response);
      }

      // if we have an error, clear the body
      if (err)
      {
        body = null;
      }

      // if a callback was specified, invoke it
      if (Util.isFunction(options.callback))
      {
        options.callback(err, body);
      }
    }
function callback ( err , response , body ) { if ( err ) { // if we haven't exceeded the maximum number of retries yet and the // server came back with a retryable error code. if ( numRetries < maxNumRetries && isRetryableError ( response , err ) ) { // increment the number of retries numRetries ++ ; // use exponential backoff with decorrelated jitter to compute the // next sleep time: var cap = connectionConfig . getRetryLargeResultSetMaxSleepTime ( ) ; sleep = Util . nextSleepTime ( 1 , cap , sleep ) ; // wait the appropriate amount of time before retrying the request setTimeout ( sendRequest , sleep * 1000 ) ; } else { // wrap the error into a network error err = Errors . createNetworkError ( ErrorCodes . ERR_LARGE_RESULT_SET_NETWORK_COULD_NOT_CONNECT , err ) ; } } // if the response contains xml, build an S3/Blob error from the response else if ( response . getResponseHeader ( 'Content-Type' ) === 'application/xml' ) { err = Errors . createLargeResultSetError ( ErrorCodes . ERR_LARGE_RESULT_SET_RESPONSE_FAILURE , response ) ; } // if we have an error, clear the body if ( err ) { body = null ; } // if a callback was specified, invoke it if ( Util . isFunction ( options . callback ) ) { options . callback ( err , body ) ; } }
invoked when the request completes
invoked when the request completes