<commit_before>var util = require('util');
var events = require('events');
var _url = require('url');
var Logger = require('./logger');

/**
 * The commands to issue on write connections
 * @private
 */
var _writeCommands = [
  'sadd', 'srem', 'lpush', 'rpush', 'llen', 'lindex', 'del', 'exists', 'set',
  'rpop', 'lpop', 'lrange', 'ltrim', 'incr', 'decr', 'persist', 'expire',
  'hmset', 'hget', 'hset', 'hsetnx', 'hdel', 'hgetall', 'publish', 'eval', 'evalsha',
  'multi', 'exec', 'script'];

/**
 * The commands to issue on read connections
 * @private
 */
var _readCommands = ['brpop', 'subscribe', 'unsubscribe'];

/**
 * A connection to redis.
 * Connects to redis with multiple write connections and read connections.
 * The write connections are used to emit commands to redis.
 * The read connections are used to listen for events.
 * This is required because once a connection is used to wait for events
 * it cannot be used to issue further requests.
 * @param index the index of the connection within the hosting bus
 * @param bus the bus object using the connection
 * @constructor
 */
function Connection(index, bus) {
  events.EventEmitter.call(this);
  this.setMaxListeners(0); // remove limit on listeners
  this.index = index;
  this.id = bus.id + ":connection:" + index;
  this._redis = bus._redis;
  this._logger = bus.logger.withTag(this.id);
  this.numPhysical = 5;
  this.nextPhysical = 0;
  this.connected = false;
  this.ready = 0;
}
<commit_msg>return physical connections to 2<commit_after>var util = require('util');
var events = require('events');
var _url = require('url');
var Logger = require('./logger');

/**
 * The commands to issue on write connections
 * @private
 */
var _writeCommands = [
  'sadd', 'srem', 'lpush', 'rpush', 'llen', 'lindex', 'del', 'exists', 'set',
  'rpop', 'lpop', 'lrange', 'ltrim', 'incr', 'decr', 'persist', 'expire',
  'hmset', 'hget', 'hset', 'hsetnx', 'hdel', 'hgetall', 'publish', 'eval', 'evalsha',
  'multi', 'exec', 'script'];

/**
 * The commands to issue on read connections
 * @private
 */
var _readCommands = ['brpop', 'subscribe', 'unsubscribe'];

/**
 * A connection to redis.
 * Connects to redis with multiple write connections and read connections.
 * The write connections are used to emit commands to redis.
 * The read connections are used to listen for events.
 * This is required because once a connection is used to wait for events
 * it cannot be used to issue further requests.
 * @param index the index of the connection within the hosting bus
 * @param bus the bus object using the connection
 * @constructor
 */
function Connection(index, bus) {
  events.EventEmitter.call(this);
  this.setMaxListeners(0); // remove limit on listeners
  this.index = index;
  this.id = bus.id + ":connection:" + index;
  this._redis = bus._redis;
  this._logger = bus.logger.withTag(this.id);
  this.numPhysical = 2;
  this.nextPhysical = 0;
  this.connected = false;
  this.ready = 0;
}

{'fraction_non_alphanumeric': 0.14994934143870314, 'fraction_numerical': 0.00303951367781155, 'mean_word_length': 4.205623901581722, 'pattern_counts': {'":': 2, '<': 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': '2049149', 'n_tokens_mistral': 920, 'n_tokens_neox': 920, 'n_words': 336}