HomeSoftware Heritage

common/utils: Use cache in origin_visit_types function

Description

common/utils: Use cache in origin_visit_types function

That function is used to dynamically retrieve the list of origin visit
types (git, svn, npm, ...) currently supported by Software Heritage.

That list of visit types is then used to populate the visit type
dropdown in the search form available in the home and search pages
of the web application.

However getting that visit types list is costly as it involves sending
an elasticsearch query through the use of swh-search.

So instead of sending that costly query each time a search form must
be rendered, prefer to cache the visit types list and update it
every 24 hours.

That change significantly speedup the homepage rendering of the
web application.

Details

Provenance
anlambertAuthored on Apr 7 2022, 11:54 AM
anlambertPushed on Apr 8 2022, 11:25 AM
Differential Revision
D7521: common/utils: Use cache in origin_visit_types function
Parents
rDWAPPSb364c93d81a6: common/utils: Add a django_cache decorator and use it in codebase
Branches
Unknown
Tags
Unknown
Build Status
Buildable 28246
Build 44221: test-and-buildJenkins console · Jenkins