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 22, 2025
1 parent 9d3278d commit cec0010
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 218 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class HostMonitoring2ConnectionPlugin extends AbstractConnectionPlugin im
result = await methodFunc();
} finally {
if (monitorContext != null) {
await this.monitorService.stopMonitoring(monitorContext, this.pluginService.getCurrentClient().targetClient);
await this.monitorService.stopMonitoring(monitorContext, this.pluginService.getCurrentClient().targetClient);

logger.debug(Messages.get("HostMonitoringConnectionPlugin.monitoringDeactivated", methodName));
}
Expand Down
14 changes: 1 addition & 13 deletions common/lib/plugins/efm2/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ export class MonitorImpl implements Monitor {
return this.activeContexts.length === 0 && MonitorImpl.newContexts.size === 0;
}

async close(): Promise<void> {
this.stopped = true;
// Waiting for 30s gives a task enough time to exit monitoring loop and close database connection.
await sleep(30000);
logger.debug(Messages.get("MonitorImpl.stopped", this.hostInfo.host));
}

startMonitoring(context: MonitorConnectionContext): void {
if (this.isStopped()) {
logger.warn(Messages.get("MonitorImpl.monitorIsStopped", this.hostInfo.host));
Expand All @@ -116,7 +109,7 @@ export class MonitorImpl implements Monitor {
const connectionQueue = MapUtils.computeIfAbsent(
MonitorImpl.newContexts,
startMonitorTimeNano,
(k) => new Array<WeakRef<MonitorConnectionContext>>()
() => new Array<WeakRef<MonitorConnectionContext>>()
);
connectionQueue.push(new WeakRef<MonitorConnectionContext>(context));
}
Expand Down Expand Up @@ -260,10 +253,6 @@ export class MonitorImpl implements Monitor {
});
}

clearContexts(): void {
this.activeContexts.length = 0;
}

isStopped(): boolean {
return this.stopped;
}
Expand Down Expand Up @@ -310,7 +299,6 @@ export class MonitorImpl implements Monitor {

async endMonitoringClient() {
if (this.monitoringClient) {

await this.pluginService.abortTargetClient(this.monitoringClient);
this.monitoringClient = null;
}
Expand Down
2 changes: 0 additions & 2 deletions common/lib/plugins/efm2/monitor_connection_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import { uniqueId } from "../../../logutils";
import { ClientWrapper } from "../../client_wrapper";
import { sleep } from "../../utils/utils";
import { AwsWrapperError } from "../../utils/errors";

/**
* Monitoring context for each connection. This contains each connection's criteria for whether a
Expand Down
2 changes: 1 addition & 1 deletion common/lib/plugins/efm2/monitor_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class MonitorServiceImpl implements MonitorService {
const cacheExpirationNanos = BigInt(WrapperProperties.MONITOR_DISPOSAL_TIME_MS.get(properties) * 1_000_000);
return MonitorServiceImpl.monitors.computeIfAbsent(
monitorKey,
(key) =>
() =>
this.monitorSupplier(
this.pluginService,
hostInfo,
Expand Down
Loading

0 comments on commit cec0010

Please sign in to comment.