Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unnecessary database hits in model_factory.py and collector.py #587

Closed
fariddarabi opened this issue Aug 8, 2022 · 1 comment
Closed

Comments

@fariddarabi
Copy link
Contributor

There is some unnecessary database hits in some modules.

first, we set request.prof_file and immediatelly call method save() on it, but it's not necessary. because method _process_response in the middleware will call save() at the end.

path: collector.finalise
image

again, method save() is called on request after meta_num_queries and meta_time_spent_queries is set.
unnecessary, because the request object will be saved in the middleware in _process_response

path: collector._record_meta_profiling
image

in ResponseModelFactory.construct_response_model, a Response object is created by method create(), so it is immediatelly saved to the database. next, Response.raw_body is set and method save() is called in the middleware.
database hits could be decreased

model_factory.ResponseModelFactory.construct_response_model
image

SilkyMiddleware._process_response
image

@albertyw
Copy link
Member

Fixed in #588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants