Skip to content

Commit

Permalink
apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-bq committed Feb 7, 2025
1 parent 35e7096 commit 5d5f0ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions mysql/lib/dialect/rds_multi_az_mysql_database_dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ export class RdsMultiAZMySQLDatabaseDialect extends MySQLDatabaseDialect impleme
RdsMultiAZMySQLDatabaseDialect.FETCH_WRITER_HOST_QUERY_COLUMN_NAME
);
// The above query returns the writer host id if it is a reader, nothing if the writer.
if ((!writerHostId)) {
if (!writerHostId) {
const currentConnection = await this.identifyConnection(targetClient);
return currentConnection ? currentConnection : null;
return currentConnection ?? null;
} else {
return null;
}
Expand Down
6 changes: 1 addition & 5 deletions pg/lib/dialect/rds_multi_az_pg_database_dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ export class RdsMultiAZPgDatabaseDialect extends PgDatabaseDialect implements To
);
const currentConnection = await this.identifyConnection(targetClient);

if (currentConnection === writerHostId) {
return currentConnection ? currentConnection : null;
} else {
return 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 5d5f0ff

Please sign in to comment.