Skip to content

Commit 0a2a1e2

Browse files
author
Gustavo Flores
committed
refactor: enhance view_cache function to accept custom timeout and update hardware-by-revision path cache duration
1 parent 297d211 commit 0a2a1e2

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

backend/kernelCI_app/urls.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99

1010
from kernelCI_app import views
1111

12-
timeout = settings.CACHE_TIMEOUT
13-
cache = cache_page(timeout)
1412

15-
16-
def view_cache(view):
17-
return cache(view.as_view())
13+
def view_cache(view, timeout: int = settings.CACHE_TIMEOUT):
14+
return cache_page(timeout)(view.as_view())
1815

1916

2017
urlpatterns = [
@@ -117,7 +114,7 @@ def view_cache(view):
117114
path("log-downloader/", view_cache(views.LogDownloaderView), name="logDownloader"),
118115
path(
119116
"hardware/selectors/",
120-
view_cache(views.HardwareSelectorsView),
117+
view_cache(views.HardwareSelectorsView, timeout=60 * 60),
121118
name="hardwareSelectors",
122119
),
123120
path(

0 commit comments

Comments
 (0)