openwisp / openwisp/openwisp-users

[bug] API mixins and classes seem to generate unneeded queries.

Open
#256 1 comment 0 reactions 1 assignee View on GitHub

@ManishShah120 is already working on this.

Since Jun 7, 2021.

bug important
Dominant language
Python
Stars
179
Forks
96
Avg merge
13h 40m
Merged PRs (30d)
16

Description

The API mixins and classes added recently to openwisp-users have been based on code from openwisp-firmware-upgrader,
but while working on openwisp/openwisp-firmware-upgrader#142 to remove the code initially added to the firmware-upgrader module in favour of the new classes added to openwisp-users, I found that the number of queries increased between 2 and 3 queries for each endpoint.

This is worrying to me: I have observed something similar for many other pull requests added recently, the number of queries is skyrocketing because we are not putting effort in keeping it in check (by using assertNumQueries in the tests).
But in firmware-upgrader we did add these assertions and now 26 tests are failing.

We should understand what the additional queries are doing, if they're really needed or not or are generated by mistake and what we can do to fix it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.