Files
elasticsearch-js/src/lib/selectors/round_robin.js
2017-06-14 18:48:24 -07:00

14 lines
405 B
JavaScript

/**
* Selects a connection the simplest way possible, Round Robin
*
* @module selectors
* @type {Function}
* @param {Array} connections - The list of connections that this selector needs to choose from
* @return {Connection} - The selected connection
*/
module.exports = function (connections) {
const connection = connections[0];
connections.push(connections.shift());
return connection;
};