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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
c8eb1dcc
Commit
c8eb1dcc
authored
May 29, 2016
by
DJ Mountney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try and use cache for application settings even when the db is not connected
parent
7d57b110
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
app/models/application_setting.rb
app/models/application_setting.rb
+4
-0
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+2
-2
No files found.
app/models/application_setting.rb
View file @
c8eb1dcc
...
@@ -98,6 +98,10 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -98,6 +98,10 @@ class ApplicationSetting < ActiveRecord::Base
Rails
.
cache
.
delete
(
CACHE_KEY
)
Rails
.
cache
.
delete
(
CACHE_KEY
)
end
end
def
self
.
cached
Rails
.
cache
.
fetch
(
CACHE_KEY
)
end
def
self
.
create_from_defaults
def
self
.
create_from_defaults
create
(
create
(
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
...
...
lib/gitlab/current_settings.rb
View file @
c8eb1dcc
...
@@ -9,9 +9,9 @@ module Gitlab
...
@@ -9,9 +9,9 @@ module Gitlab
end
end
def
ensure_application_settings!
def
ensure_application_settings!
settings
=
nil
settings
=
::
ApplicationSetting
.
cached
if
connect_to_db?
if
!
settings
&&
connect_to_db?
settings
=
::
ApplicationSetting
.
current
settings
=
::
ApplicationSetting
.
current
settings
||=
::
ApplicationSetting
.
create_from_defaults
unless
ActiveRecord
::
Migrator
.
needs_migration?
settings
||=
::
ApplicationSetting
.
create_from_defaults
unless
ActiveRecord
::
Migrator
.
needs_migration?
end
end
...
...
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