Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
joyc-bq committed Feb 12, 2025
1 parent 0586e82 commit 734d092
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion mysql/lib/dialect/rds_multi_az_mysql_database_dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ export class RdsMultiAZMySQLDatabaseDialect extends MySQLDatabaseDialect impleme
}

async getHostRole(client: ClientWrapper): Promise<HostRole> {
return (await this.executeTopologyRelatedQuery(client, RdsMultiAZMySQLDatabaseDialect.IS_READER_QUERY, RdsMultiAZMySQLDatabaseDialect.IS_READER_QUERY_COLUMN_NAME)) == "0" ? HostRole.WRITER : HostRole.READER;
return (await this.executeTopologyRelatedQuery(
client,
RdsMultiAZMySQLDatabaseDialect.IS_READER_QUERY,
RdsMultiAZMySQLDatabaseDialect.IS_READER_QUERY_COLUMN_NAME
)) == "0"
? HostRole.WRITER
: HostRole.READER;
}

async getWriterId(targetClient: ClientWrapper): Promise<string> {
Expand Down
10 changes: 8 additions & 2 deletions pg/lib/dialect/rds_multi_az_pg_database_dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ export class RdsMultiAZPgDatabaseDialect extends PgDatabaseDialect implements To
}

async getHostRole(client: ClientWrapper): Promise<HostRole> {
return (await this.executeTopologyRelatedQuery(client, RdsMultiAZPgDatabaseDialect.IS_READER_QUERY, RdsMultiAZPgDatabaseDialect.IS_READER_QUERY_COLUMN_NAME)) === false ? HostRole.WRITER : HostRole.READER;
return (await this.executeTopologyRelatedQuery(
client,
RdsMultiAZPgDatabaseDialect.IS_READER_QUERY,
RdsMultiAZPgDatabaseDialect.IS_READER_QUERY_COLUMN_NAME
)) === false
? HostRole.WRITER
: HostRole.READER;
}

async getWriterId(targetClient: ClientWrapper): Promise<string> {
Expand All @@ -143,7 +149,7 @@ export class RdsMultiAZPgDatabaseDialect extends PgDatabaseDialect implements To
);
const currentConnection = await this.identifyConnection(targetClient);

return (currentConnection && currentConnection === writerHostId) ? currentConnection : null;
return currentConnection && currentConnection === writerHostId ? currentConnection : null;
} catch (error: any) {
throw new AwsWrapperError(Messages.get("RdsMultiAZPgDatabaseDialect.invalidQuery", error.message));
}
Expand Down

0 comments on commit 734d092

Please sign in to comment.