Projet

Général

Profil

0001-health-api-cache-results-26836.patch

Christophe Siraut, 15 novembre 2018 15:01

Télécharger (1,44 ko)

Voir les différences:

Subject: [PATCH] health api: cache results (#26836)

 debian/debian_config_common.py |  2 ++
 hobo/rest/urls.py              | 10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
debian/debian_config_common.py
369 369
THEMES_DIRECTORY = '/usr/share/publik/themes/'
370 370

  
371 371
USE_X_FORWARDED_FOR = True
372

  
373
HEALTHAPI_TIMEOUT = 600
hobo/rest/urls.py
14 14
# You should have received a copy of the GNU General Public License
15 15
# along with this program; if not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf import settings
17 18
from django.conf.urls import url
19
from django.views.decorators.cache import cache_page
18 20
from .views import HealthList
19 21

  
22
try:
23
    timeout = settings.HEALTHAPI_TIMEOUT
24
except AttributeError:
25
    timeout = 600
26

  
27

  
20 28
urlpatterns = [
21
    url(r'^health/$', HealthList.as_view(), name='api-health-list'),
29
    url(r'^health/$', cache_page(timeout)(HealthList.as_view()), name='api-health-list'),
22 30
]
23
-