<commit_before>'use strict';

var async = require('async');
var logger = require('winston');
var util = require('util');
var Riak = require('basho-riak-client');

var c = null;
var intervals = null;

function stopClient() {
    if (intervals) {
        intervals.forEach(function (i) {
            if (i) {
                clearInterval(i);
            }
        });
    }
    if (c) {
        c.stop(function (err) {
            if (err) {
                logger.error('[GitHubIssue137] err: %s', err);
            }
        });
    }
}

/*
var nodes = [
    'riak-test:10117',
    'riak-test:10127',
    'riak-test:10137',
    'riak-test:10147',
    'riak-test:10157'
];
var nodes = [
    'riak-test:10017',
    'riak-test:10027',
    'riak-test:10037',
    'riak-test:10047',
    'riak-test:10057'
];
*/
var nodes = [
    'riak-test:10117',
    'riak-test:10117',
    'riak-test:10117',
    'riak-test:10117',
    'riak-test:10117',
];

c = new Riak.Client(nodes, function (err, client) {
    if (err) {
        logger.error('[GitHubIssue137] err: %s', err);
    }

    var batch_size = 64;
    var finalCount = Math.pow(2, 20);

    var storeIntervalMs = 10;
    var storeValueInterval = null;
    var fetchIntervalMs = 10;
    var fetchValueInterval = null;

    var key = 1;
    var storeCount = 0;
    function makeStoreValueFunc() {
        return function(acb) {
            var obj = new Riak.Commands.KV.RiakObject();
            obj.setContentType('text/plain');
            obj.setValue('github-issue-137');
            var o = {<commit_msg>Update to test load balancer setting<commit_after>'use strict';

var async = require('async');
var logger = require('winston');
var util = require('util');
var Riak = require('basho-riak-client');

var c = null;
var intervals = null;

function stopClient() {
    if (intervals) {
        intervals.forEach(function (i) {
            if (i) {
                clearInterval(i);
            }
        });
    }
    if (c) {
        c.stop(function (err) {
            if (err) {
                logger.error('[GitHubIssue137] err: %s', err);
            }
        });
    }
}

/*
var nodes = [
    'riak-test:10117',
    'riak-test:10127',
    'riak-test:10137',
    'riak-test:10147',
    'riak-test:10157'
];
var nodes = [
    'riak-test:10017',
    'riak-test:10027',
    'riak-test:10037',
    'riak-test:10047',
    'riak-test:10057'
];
*/
var nodeAddresses = [
    'riak-test:10117',
];

var nodeBuilder = new Riak.Node.Builder();
var nodeTemplate = nodeBuilder.withExternalLoadBalancer(true);
var nodes = Riak.Node.buildNodes(nodeAddresses, nodeTemplate);

var cb = new Riak.Cluster.Builder();
cb.withRiakNodes(nodes);
var cluster = cb.build();

c = new Riak.Client(cluster, function (err, client) {
    if (err) {
        logger.error('[GitHubIssue137] err: %s', err);
    }

    var batch_size = 64;
    var finalCount = Math.pow(2, 20);

    var storeIntervalMs = 250;
    var storeValueInterval = null;
    var fetchIntervalMs = 250;
    var fetchValueInterval = null;

    var key = 1;
    var storeCount = 0;
    function makeStoreValueFunc() {
        return function(acb) {
            var obj = new Riak.Commands.KV.RiakObject();
            obj.setContentType('text/plain');
            obj.setValue('github-issue-137');
            var o = {
{'fraction_non_alphanumeric': 0.1537764350453172, 'fraction_numerical': 0.051963746223564956, 'mean_word_length': 2.301096709870389, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3479067', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1149, 'n_words': 238}