Skip to content
Snippets Groups Projects
Commit c8d5a61b authored by jan.bednarik's avatar jan.bednarik
Browse files

donate: Set API calls cache to 5 min

parent 098683b7
No related branches found
No related tags found
2 merge requests!82donate: Set API calls cache to 5 min,!81donate: Set API calls cache to 5 min
Pipeline #1096 passed
from django.conf import settings
from django.core.cache import cache
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
......@@ -447,7 +448,7 @@ class DonateProjectPage(DonateFormMixin, Page, SubpageMixin, MetadataPageMixin):
# save amount into database to be used if next API calls fails
self.donated_amount = amount
self.save()
cache.set(key, amount)
cache.set(key, amount, settings.DONATE_PORTAL_API_CACHE_TIMEOUT)
self._donated_amount = self.donated_amount or 0
return self._donated_amount
......
......@@ -222,3 +222,4 @@ DONATE_PORTAL_REDIRECT_SOURCE = env.str(
)
DONATE_PORTAL_API_URL = env.str("DONATE_PORTAL_API_URL", default="")
DONATE_PORTAL_API_TIMEOUT = 5
DONATE_PORTAL_API_CACHE_TIMEOUT = 60 * 5
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment