Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0bd924fc
Commit
0bd924fc
authored
Jan 12, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Memoize those values and clear properly
parent
acbfa60e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
ee/app/helpers/auditor_user_helper.rb
ee/app/helpers/auditor_user_helper.rb
+5
-1
ee/app/workers/geo/base_scheduler_worker.rb
ee/app/workers/geo/base_scheduler_worker.rb
+5
-2
No files found.
ee/app/helpers/auditor_user_helper.rb
View file @
0bd924fc
module
AuditorUserHelper
include
::
Gitlab
::
Utils
::
StrongMemoize
def
license_allows_auditor_user?
@license_allows_auditor_user
||=
::
License
.
feature_available?
(
:auditor_user
)
strong_memoize
(
:license_allows_auditor_user
)
do
::
License
.
feature_available?
(
:auditor_user
)
end
end
end
ee/app/workers/geo/base_scheduler_worker.rb
View file @
0bd924fc
...
...
@@ -2,6 +2,7 @@ module Geo
class
BaseSchedulerWorker
include
ApplicationWorker
include
ExclusiveLeaseGuard
include
::
Gitlab
::
Utils
::
StrongMemoize
DB_RETRIEVE_BATCH_SIZE
=
1000
LEASE_TIMEOUT
=
60
.
minutes
...
...
@@ -183,10 +184,12 @@ module Geo
# Only check every minute to avoid polling the DB excessively
unless
@last_enabled_check
.
present?
&&
@last_enabled_check
>
1
.
minute
.
ago
@last_enabled_check
=
Time
.
now
@current_node_enabled
=
nil
clear_memoization
(
:current_node_enabled
)
end
@current_node_enabled
||=
Gitlab
::
Geo
.
current_node_enabled?
strong_memoize
(
:current_node_enabled
)
do
Gitlab
::
Geo
.
current_node_enabled?
end
end
def
log_info
(
message
,
extra_args
=
{})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment