hyperswitch
hyperswitch copied to clipboard
[REFACTOR] Update Database Connection Functions for Read Operations
Feature Description
Currently, in our codebase, we are using pg_connection_write
for database operations even when performing read operations, which is inefficient. The pg_connection_write
function should only be used when we need to perform write operations. For read operations, we should use pg_connection_read
to optimize resource usage.
Possible Implementation
Find occurrences of the usage of pg_connection_write
for read operations and replace them with pg_connection_read
in the following files:
-
crates/router/src/db/role.rs
-
crates/router/src/db/user.rs
-
crates/router/src/db/user_role.rs
-
crates/router/src/db/dashboard_metadata.rs
- Open each of the specified files and search for functions that are performing read operations (for e.g.,
find_by_*
,get_*
) but are usingpg_connection_write
. - Replace the usage of
pg_connection_write
withpg_connection_read
in these functions. - Ensure that the database calls still behave correctly and no write operations are mistakenly changed.
Have you spent some time checking if this feature request has been raised before?
- [X] I checked and didn't find a similar issue
Submission Process:
- Ask the maintainers for assignment of the issue, you can request for assignment by commenting on the issue itself.
- Once assigned, submit a pull request (PR).
- Maintainers will review and provide feedback, if any.
- Maintainers can unassign issues due to inactivity, read more here.
Refer here for Terms and conditions for the contest.