Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
c8d5a61b
Commit
c8d5a61b
authored
4 years ago
by
jan.bednarik
Browse files
Options
Downloads
Patches
Plain Diff
donate: Set API calls cache to 5 min
parent
098683b7
Branches
Branches containing commit
No related tags found
2 merge requests
!82
donate: Set API calls cache to 5 min
,
!81
donate: Set API calls cache to 5 min
Pipeline
#1096
passed
4 years ago
Stage: build
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
donate/models.py
+2
-1
2 additions, 1 deletion
donate/models.py
majak/settings/base.py
+1
-0
1 addition, 0 deletions
majak/settings/base.py
with
3 additions
and
1 deletion
donate/models.py
+
2
−
1
View file @
c8d5a61b
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.core.paginator
import
EmptyPage
,
PageNotAnInteger
,
Paginator
from
django.core.paginator
import
EmptyPage
,
PageNotAnInteger
,
Paginator
from
django.db
import
models
from
django.db
import
models
...
@@ -447,7 +448,7 @@ class DonateProjectPage(DonateFormMixin, Page, SubpageMixin, MetadataPageMixin):
...
@@ -447,7 +448,7 @@ class DonateProjectPage(DonateFormMixin, Page, SubpageMixin, MetadataPageMixin):
# save amount into database to be used if next API calls fails
# save amount into database to be used if next API calls fails
self
.
donated_amount
=
amount
self
.
donated_amount
=
amount
self
.
save
()
self
.
save
()
cache
.
set
(
key
,
amount
)
cache
.
set
(
key
,
amount
,
settings
.
DONATE_PORTAL_API_CACHE_TIMEOUT
)
self
.
_donated_amount
=
self
.
donated_amount
or
0
self
.
_donated_amount
=
self
.
donated_amount
or
0
return
self
.
_donated_amount
return
self
.
_donated_amount
...
...
This diff is collapsed.
Click to expand it.
majak/settings/base.py
+
1
−
0
View file @
c8d5a61b
...
@@ -222,3 +222,4 @@ DONATE_PORTAL_REDIRECT_SOURCE = env.str(
...
@@ -222,3 +222,4 @@ DONATE_PORTAL_REDIRECT_SOURCE = env.str(
)
)
DONATE_PORTAL_API_URL
=
env
.
str
(
"
DONATE_PORTAL_API_URL
"
,
default
=
""
)
DONATE_PORTAL_API_URL
=
env
.
str
(
"
DONATE_PORTAL_API_URL
"
,
default
=
""
)
DONATE_PORTAL_API_TIMEOUT
=
5
DONATE_PORTAL_API_TIMEOUT
=
5
DONATE_PORTAL_API_CACHE_TIMEOUT
=
60
*
5
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment