rbt_mssql-pool-party
Version:
Extension of mssql that provides management of multiple connection pools, dsns, retries, and more
14 lines (13 loc) • 385 B
JavaScript
export default function poolPrioritySort(a, b) {
if (a.connection.connected && !b.connection.connected) {
return -1;
}
if (!a.connection.connected && b.connection.connected) {
return 1;
}
if (!a.connection.connected && !b.connection.connected) {
return 0;
}
// if both pools are connected, then we sort by priority
return a.dsn.priority - b.dsn.priority;
}