element-hq / element-hq/synapse
Remove redundant db calls from Login rest endpoint
Open
O-Occasional
S-Tolerable
T-Enhancement
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
**Description:**
when I was testing the login endpoint I noticed in jaeger that it calls the db 2 times, the first db call to get the `name` and `password_hash` and in the second call it gets `deactivated` status. instead of making it two queries, I suggest to make it in one query.
here is a screenshot for you:

the suggested new query
```sql
SELECT name, password_hash, deactivated FROM users WHERE lower(name) = lower(name)
```
also, you should remove the `name` from the select query because you already have it.
Contributor guide
Assessment
This issue has not been assessed yet.