Reduce database connnections required for routes::users::details #888

Closed
opened 2021-01-30 08:00:25 +00:00 by KitaitiMakoto · 0 comments

routes::users::detals() requires many DbConn. Its function signature requires a DbConn and three PlumeRockets, which has DbConn as a field. Additionally, other DbConns are retrieved in internal functions.

This occurs 503 error on proceeding, especially in the case of low database connection limit.

To fix this issue, we need to:

  1. Extract DbConn from PlumeRocket as said at #797 and tried at #805 I gave up. See #889.
  2. Change method signature of implementations of FromIds. ctx argument of from_id, from_activity and from_db should be a database connection instead of PlumeRocket (definition of FromId trait itself need not change)
  3. Share database pool with SearchActor (or remove dependency on database connection from SearchActor)
  4. Extract thread worker tasks in routes::users::details() as an actor's method, such that holds DbPool and retrieves DbConn on demand
`routes::users::detals()` requires many `DbConn`. Its function signature requires a `DbConn` and three `PlumeRocket`s, which has `DbConn` as a field. Additionally, other `DbConn`s are retrieved in internal functions. This occurs 503 error on proceeding, especially in the case of low database connection limit. To fix this issue, we need to: 1. [ ] ~~Extract `DbConn` from `PlumeRocket` as said at #797 and tried at #805~~ I gave up. See #889. 2. [x] Change method signature of implementations of `FromId`s. `ctx` argument of `from_id`, `from_activity` and `from_db` should be a database connection instead of `PlumeRocket` (definition of `FromId` trait itself need not change) 3. [x] Share database pool with `SearchActor` (or remove dependency on database connection from `SearchActor`) 4. [x] Extract thread worker tasks in `routes::users::details()` as an actor's method, such that holds `DbPool` and retrieves `DbConn` on demand
KitaitiMakoto added this to the 0.7.0 milestone 2021-01-30 16:03:03 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Plume/Plume#888
No description provided.