lib/runner/replay-controller.js
function (context, item, desiredPayload, success, failure) {
        // max retries exceeded
        if (this.count >= MAX_REPLAY_COUNT) {
            return failure(new Error('runtime: maximum intermediate request limit exceeded'));
        }

        // update replay count state
        this.count++;

        // update replay state to context
        context.replayState = this.getReplayState();

        // construct payload for request
        var payload = _.defaults({
            item: item,
            // abortOnError makes sure request command bubbles errors
            // so we can pass it on to the callback
            abortOnError: true
        }, desiredPayload);

        // create item context from the new item
        payload.context = createItemContext(payload, context);

        this.run.immediate('httprequest', payload)
            .done(function (response) {
                success(null, response);
            })
            .catch(success);
    }
function (context, item, desiredPayload, success, failure) {
        // max retries exceeded
        if (this.count >= MAX_REPLAY_COUNT) {
            return failure(new Error('runtime: maximum intermediate request limit exceeded'));
        }

        // update replay count state
        this.count++;

        // update replay state to context
        context.replayState = this.getReplayState();

        // construct payload for request
        var payload = _.defaults({
            item: item,
            // abortOnError makes sure request command bubbles errors
            // so we can pass it on to the callback
            abortOnError: true
        }, desiredPayload);

        // create item context from the new item
        payload.context = createItemContext(payload, context);

        this.run.immediate('httprequest', payload)
            .done(function (response) {
                success(null, response);
            })
            .catch(success);
    }
function ( context , item , desiredPayload , success , failure ) { // max retries exceeded if ( this . count >= MAX_REPLAY_COUNT ) { return failure ( new Error ( 'runtime: maximum intermediate request limit exceeded' ) ) ; } // update replay count state this . count ++ ; // update replay state to context context . replayState = this . getReplayState ( ) ; // construct payload for request var payload = _ . defaults ( { item : item , // abortOnError makes sure request command bubbles errors // so we can pass it on to the callback abortOnError : true } , desiredPayload ) ; // create item context from the new item payload . context = createItemContext ( payload , context ) ; this . run . immediate ( 'httprequest' , payload ) . done ( function ( response ) { success ( null , response ) ; } ) . catch ( success ) ; }
Sends a request in the item. This takes care of limiting the total number of replays for a request.

@param {Object} context
@param {Request} item
@param {Object} desiredPayload a partial payload to use for the replay request
@param {Function} success this callback is invoked when replay controller sent the request
@param {Function} failure this callback is invoked when replay controller decided not to send the request
Sends a request in the item . This takes care of limiting the total number of replays for a request .