Skip to content

Commit

Permalink
format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joyc-bq committed Jan 23, 2025
1 parent 47c22df commit 73f6395
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 21 deletions.
3 changes: 1 addition & 2 deletions common/lib/plugins/efm/monitor_connection_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export class MonitorConnectionContext {

const totalElapsedTimeNano: number = statusCheckEndNano - this.startMonitorTimeNano;
if (totalElapsedTimeNano > this.failureDetectionTimeMillis * 1000000) {

await this.setConnectionValid(hostName, isValid, statusCheckStartNano, statusCheckEndNano);
}
}
Expand Down Expand Up @@ -129,7 +128,7 @@ export class MonitorConnectionContext {
const invalidHostDurationNano: number = statusCheckEndNano - this.invalidHostStartTimeNano;
const maxInvalidHostDurationMillis: number = this.failureDetectionIntervalMillis * Math.max(0, this.failureDetectionCount);
logger.debug("got hereeee");
if ( invalidHostDurationNano >= maxInvalidHostDurationMillis * 1_000_000) {
if (invalidHostDurationNano >= maxInvalidHostDurationMillis * 1_000_000) {
logger.debug(Messages.get("MonitorConnectionContext.hostDead", hostName));
this.isHostUnhealthy = true;
await this.abortConnection();
Expand Down
8 changes: 3 additions & 5 deletions common/lib/plugins/efm2/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export class MonitorImpl implements Monitor {
this.telemetryFactory.createGauge(`efm2.hostHealthy.${hostId}`, () => (this.hostUnhealthy ? 0 : 1));
const task1 = this.newContextRun();
const task2 = this.run();
Promise.race([task1, task2]);
Promise.race([task1, task2]).finally(() => {
this.stopped = true;
});
}

canDispose(): boolean {
Expand Down Expand Up @@ -204,7 +206,6 @@ export class MonitorImpl implements Monitor {
} catch (error: any) {
logger.debug(Messages.get("MonitorImpl.exceptionDuringMonitoringStop", error.message));
} finally {
this.stopped = true;
await this.endMonitoringClient();
await sleep(3000);
}
Expand All @@ -222,7 +223,6 @@ export class MonitorImpl implements Monitor {
connectContext.setAttribute("url", this.hostInfo.host);
try {
if (!(await this.pluginService.isClientValid(this.monitoringClient))) {

// Open a new connection.
const monitoringConnProperties: Map<string, any> = new Map(this.properties);

Expand All @@ -242,8 +242,6 @@ export class MonitorImpl implements Monitor {
}
return true;
} catch (error: any) {
logger.debug("return false catch err");

return false;
}
}
Expand Down
3 changes: 1 addition & 2 deletions common/lib/plugins/efm2/monitor_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ export class MonitorServiceImpl implements MonitorService {
// ignore
logger.debug(Messages.get("MonitorConnectionContext.exceptionAbortingConnection", error.message));
}
}
else {
} else {
context.setInactive();
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/lib/wrapper_property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class WrapperProperty<T> {

export class WrapperProperties {
static readonly MONITORING_PROPERTY_PREFIX: string = "monitoring_";
static readonly DEFAULT_PLUGINS = "auroraConnectionTracker,failover,efm";
static readonly DEFAULT_PLUGINS = "auroraConnectionTracker,failover,efm2";
static readonly DEFAULT_TOKEN_EXPIRATION_SEC = 15 * 60;

static readonly PLUGINS = new WrapperProperty<string>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const client = new AwsPGClient({
user: username,
password: password,
database: database,
plugins: "readWriteSplitting,failover,efm",
plugins: "readWriteSplitting,failover,efm2",

// Optional: PoolKey property value and connection provider used in internal connection pools.
connectionProvider: provider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const client = new AwsMySQLClient({
user: username,
password: password,
database: database,
plugins: "readWriteSplitting, failover, efm"
plugins: "readWriteSplitting, failover, efm2"
});

// Setup Step: Open connection and create tables - uncomment this section to create table and test values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const database = "database";
const port = 3306;

const client = new AwsMySQLClient({
// Configure connection parameters. Enable readWriteSplitting, failover, and efm plugins.
// Configure connection parameters. Enable readWriteSplitting, failover, and efm2 plugins.
host: mysqlHost,
port: port,
user: username,
password: password,
database: database,
plugins: "readWriteSplitting, fastestResponseStrategy, failover, efm",
plugins: "readWriteSplitting, fastestResponseStrategy, failover, efm2",
readerHostSelectorStrategy: "fastestResponse"
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const client = new AwsPGClient({
user: username,
password: password,
database: database,
plugins: "readWriteSplitting, fastestResponseStrategy, failover, efm",
plugins: "readWriteSplitting, fastestResponseStrategy, failover, efm2",
readerHostSelectorStrategy: "fastestResponse"
});

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/container/tests/aurora_failover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const itIf =
!features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) &&
instanceCount >= 2
? it
: it.skip;
: it;
const itIfTwoInstance = instanceCount == 2 ? itIf : it.skip;

let env: TestEnvironment;
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/container/tests/autoscaling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const itIf =
!features.includes(TestEnvironmentFeatures.PERFORMANCE) &&
features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) &&
instanceCount >= 2
? it.skip
? it
: it.skip;
const itIfMinFiveInstance = instanceCount >= 5 ? itIf : it.skip;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { DatabaseEngineDeployment } from "./utils/database_engine_deployment";
import { PluginManager } from "../../../../common/lib";

const itIf =
!features.includes(TestEnvironmentFeatures.PERFORMANCE) && !features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) ? it.skip : it.skip;
!features.includes(TestEnvironmentFeatures.PERFORMANCE) && !features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) ? it : it.skip;

let client: any;
let auroraTestUtility: AuroraTestUtility;
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/container/tests/performance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const itIf =
features.includes(TestEnvironmentFeatures.PERFORMANCE) &&
features.includes(TestEnvironmentFeatures.NETWORK_OUTAGES_ENABLED) &&
!features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY)
? it.skip
? it
: it.skip;

const REPEAT_TIMES: number = process.env.REPEAT_TIMES ? Number(process.env.REPEAT_TIMES) : 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const itIf =
features.includes(TestEnvironmentFeatures.PERFORMANCE) &&
features.includes(TestEnvironmentFeatures.NETWORK_OUTAGES_ENABLED) &&
instanceCount >= 5
? it.skip
? it
: it.skip;

const REPEAT_TIMES: number = process.env.REPEAT_TIMES ? Number(process.env.REPEAT_TIMES) : 10;
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/container/tests/session_state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { AwsMySQLClient } from "../../../../mysql/lib";
import { TransactionIsolationLevel } from "../../../../common/lib/utils/transaction_isolation_level";

const itIf =
!features.includes(TestEnvironmentFeatures.PERFORMANCE) && !features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) ? it.skip : it.skip;
!features.includes(TestEnvironmentFeatures.PERFORMANCE) && !features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) ? it : it.skip;

let client: any;

Expand Down

0 comments on commit 73f6395

Please sign in to comment.