Compare commits
No commits in common. "6c72961d125dbaf1cab43294f63babf4b787b803" and "8a03f4e171e2c81c7b906e6e89df0deb9add206b" have entirely different histories.
6c72961d12
...
8a03f4e171
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@navy.gif/wrappers",
|
||||
"version": "1.6.8",
|
||||
"version": "1.6.7",
|
||||
"description": "Various wrapper classes I use in my projects",
|
||||
"repository": "https://git.corgi.wtf/Navy.gif/wrappers.git",
|
||||
"author": "Navy.gif",
|
||||
|
@ -24,8 +24,7 @@ export type MariaOptions = {
|
||||
cluster?: PoolClusterConfig,
|
||||
client?: PoolConfig,
|
||||
credentials: Credentials,
|
||||
loggerOptions?: LoggerClientOptions,
|
||||
donorQuery?: boolean
|
||||
loggerOptions?: LoggerClientOptions
|
||||
}
|
||||
|
||||
type MariaError = {
|
||||
@ -94,9 +93,8 @@ class MariaDB
|
||||
#cluster: boolean;
|
||||
#pool: PoolCluster | null;
|
||||
#nodes: Node[];
|
||||
#canQueryDonor: boolean;
|
||||
|
||||
constructor (server: IServer, options: MariaOptions)
|
||||
constructor (server: IServer, options: MariaOptions)
|
||||
{
|
||||
|
||||
if (!server)
|
||||
@ -126,7 +124,6 @@ class MariaDB
|
||||
this.#afterLastQuery = null;
|
||||
|
||||
this.#cluster = this.#credentials.length > 1;
|
||||
this.#canQueryDonor = options.donorQuery ?? false;
|
||||
this.#logger = server.createLogger(this, options.loggerOptions);
|
||||
|
||||
}
|
||||
@ -341,7 +338,7 @@ class MariaDB
|
||||
const pool = this.#pool;
|
||||
if (nodeName)
|
||||
{
|
||||
const available = this.#nodes.filter(n => n.status === 'synced' || !n.status || (this.#canQueryDonor && n.status === 'donor'));
|
||||
const available = this.#nodes.filter(n => n.status === 'synced');
|
||||
if (!available.length)
|
||||
throw new Error('No nodes available for query');
|
||||
const node = this.#nodes.find(n => n.name === nodeName);
|
||||
@ -353,7 +350,7 @@ class MariaDB
|
||||
this.#logger.warn(str);
|
||||
nodeName = '*';
|
||||
}
|
||||
else if (node.status && node.status !== 'synced' && !(this.#canQueryDonor && node.status === 'donor'))
|
||||
else if (node.status && node.status !== 'synced')
|
||||
{
|
||||
const str = `Node ${nodeName} is currently not synced with the pool and thus unqueryable`;
|
||||
if (throwError)
|
||||
|
Loading…
Reference in New Issue
Block a user