2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-13 06:01:35 +00:00

Docker fixes again (#10145)

* Add helper function for debugging query counts

* Adjust counts again

* Add docs to contributing.md
This commit is contained in:
Oliver
2025-08-07 23:28:13 +10:00
committed by GitHub
parent 61c8a8f703
commit 7327efbafd
3 changed files with 50 additions and 20 deletions

View File

@@ -208,6 +208,21 @@ coverage html -i
The coverage database is also generated in the CI-pipeline and exposd for 14 days as a artifact named `coverage`.
### Database Query Profiling
It may be useful during development to profile parts of the backend code to see how many database queries are executed. To that end, the `count_queries` context manager can be used to count the number of queries executed in a specific code block.
```python
from InvenTree.helpers import count_queries
with count_queries("My code block"):
# Code block to profile
...
```
A developer can use this to profile a specific code block, and the number of queries executed will be printed to the console.
## Code Style
Code style is automatically checked as part of the project's CI pipeline on GitHub. This means that any pull requests which do not conform to the style guidelines will fail CI checks.