Bug 1025159
| Summary: | [XMLRPC] Cache Product to save resources | ||
|---|---|---|---|
| Product: | [Other] TCMS | Reporter: | cqi |
| Component: | XMLRPC | Assignee: | Yang Ren <ryang> |
| Status: | NEW --- | QA Contact: | |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | Devel | CC: | cqi, ryang, zxiong |
| Target Milestone: | --- | Keywords: | Improvement, Performance |
| Target Release: | 3.9.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Enhancement | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | Bug | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
It wastes resources to get a whole Product object repeatedly each time methods get called, which is only for constructing QuerySet search criteria. Cache every Product object's ID got previously will save much resources. The cache could be a simple dict, maintaining the mapping from id and name to Product's id individually. Like this, { 1: 1, 'Product 1 name': 1, 2: 2, 'Product 2 name': 2, .... } Here, we really don't need to map to a whole Product object, the ID is enough. Meanwhile, with this cache, it's possible to simplify pre_check_product method also.