Skip to content

Commit

Permalink
chore: remove unnecessary dependencies and update 3rd party license f…
Browse files Browse the repository at this point in the history
…ile (#283)
  • Loading branch information
karenc-bq authored Nov 5, 2024
1 parent abf03fd commit 73a9e28
Show file tree
Hide file tree
Showing 9 changed files with 448 additions and 177 deletions.
316 changes: 220 additions & 96 deletions third-party-licenses.txt → THIRD-PARTY-LICENSES

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions common/lib/plugins/default_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
limitations under the License.
*/

import { uniqueId } from "lodash";
import { logger } from "../../logutils";
import { logger, uniqueId } from "../../logutils";
import { Messages } from "../utils/messages";
import { HostListProviderService } from "../host_list_provider_service";
import { HostInfo } from "../host_info";
Expand Down
3 changes: 1 addition & 2 deletions common/lib/plugins/efm/host_monitoring_connection_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import { HostChangeOptions } from "../../host_change_options";
import { HostInfo } from "../../host_info";
import { OldConnectionSuggestionAction } from "../../old_connection_suggestion_action";
import { RdsUtils } from "../../utils/rds_utils";
import { uniqueId } from "lodash";
import { AbstractConnectionPlugin } from "../../abstract_connection_plugin";
import { RdsUrlType } from "../../utils/rds_url_type";
import { WrapperProperties } from "../../wrapper_property";
import { MonitorConnectionContext } from "./monitor_connection_context";
import { logger } from "../../../logutils";
import { logger, uniqueId } from "../../../logutils";
import { Messages } from "../../utils/messages";
import { MonitorService, MonitorServiceImpl } from "./monitor_service";
import { AwsWrapperError } from "../../utils/errors";
Expand Down
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 @@ -15,12 +15,11 @@
*/

import { Monitor } from "./monitor";
import { logger } from "../../../logutils";
import { logger, uniqueId } from "../../../logutils";
import { Messages } from "../../utils/messages";
import { ClientWrapper } from "../../client_wrapper";
import { sleep } from "../../utils/utils";
import { AwsWrapperError } from "../../utils/errors";
import { uniqueId } from "lodash";
import { PluginService } from "../../plugin_service";
import { TelemetryCounter } from "../../utils/telemetry/telemetry_counter";

Expand Down
3 changes: 1 addition & 2 deletions common/lib/plugins/failover/reader_failover_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ import { getTimeoutTask, maskProperties, shuffleList, sleep } from "../../utils/
import { HostRole } from "../../host_role";
import { HostAvailability } from "../../host_availability/host_availability";
import { AwsWrapperError, InternalQueryTimeoutError } from "../../utils/errors";
import { logger } from "../../../logutils";
import { logger, uniqueId } from "../../../logutils";
import { Messages } from "../../utils/messages";
import { WrapperProperties } from "../../wrapper_property";
import { ReaderTaskSelectorHandler } from "./reader_task_selector";
import { uniqueId } from "lodash";
import { FailoverRestriction } from "./failover_restriction";

export interface ReaderFailoverHandler {
Expand Down
5 changes: 2 additions & 3 deletions common/lib/round_robin_host_selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { WrapperProperties, WrapperProperty } from "./wrapper_property";
import { AwsWrapperError } from "./utils/errors";
import { CacheMap } from "./utils/cache_map";
import { HostAvailability } from "./host_availability/host_availability";
import { isInteger } from "lodash";
import { Messages } from "./utils/messages";

export class RoundRobinHostSelector implements HostSelector {
Expand Down Expand Up @@ -153,7 +152,7 @@ export class RoundRobinHostSelector implements HostSelector {
let defaultWeight = RoundRobinHostSelector.DEFAULT_WEIGHT;
if (props) {
defaultWeight = WrapperProperties.ROUND_ROBIN_DEFAULT_WEIGHT.get(props);
if (!isInteger(defaultWeight) || defaultWeight < RoundRobinHostSelector.DEFAULT_WEIGHT) {
if (!Number.isInteger(defaultWeight) || defaultWeight < RoundRobinHostSelector.DEFAULT_WEIGHT) {
throw new AwsWrapperError(Messages.get("HostSelector.roundRobinInvalidDefaultWeight"));
}
roundRobinClusterInfo.lastClusterDefaultWeightPropertyValue = defaultWeight;
Expand Down Expand Up @@ -181,7 +180,7 @@ export class RoundRobinHostSelector implements HostSelector {
}

const weight = Number(hostWeight);
if (isNaN(weight) || !isInteger(weight) || weight < RoundRobinHostSelector.DEFAULT_WEIGHT) {
if (isNaN(weight) || !Number.isInteger(weight) || weight < RoundRobinHostSelector.DEFAULT_WEIGHT) {
throw new AwsWrapperError(Messages.get("HostSelector.roundRobinInvalidHostWeightPairs"));
}
roundRobinClusterInfo.clusterWeightsMap.set(hostName, weight);
Expand Down
4 changes: 4 additions & 0 deletions common/logutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ dotenv.config();

const logLevel = process.env.LOG_LEVEL;

export function uniqueId(prefix: string): string {
return `${prefix}${Math.random().toString(16).slice(2)}`;
}

export const logger = createLogger({
format: combine(
colorize(),
Expand Down
Loading

0 comments on commit 73a9e28

Please sign in to comment.