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
76f526a9
Commit
76f526a9
authored
May 21, 2020
by
Rajendra Kadam
Committed by
Peter Leitzen
May 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use applogger in cache attrs and highest role ruby files
parent
11271ac4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
app/models/concerns/cacheable_attributes.rb
app/models/concerns/cacheable_attributes.rb
+1
-1
app/models/concerns/update_highest_role.rb
app/models/concerns/update_highest_role.rb
+1
-3
changelogs/unreleased/rails-logger-cop-6.yml
changelogs/unreleased/rails-logger-cop-6.yml
+5
-0
spec/models/concerns/cacheable_attributes_spec.rb
spec/models/concerns/cacheable_attributes_spec.rb
+2
-2
No files found.
app/models/concerns/cacheable_attributes.rb
View file @
76f526a9
...
...
@@ -55,7 +55,7 @@ module CacheableAttributes
current_without_cache
.
tap
{
|
current_record
|
current_record
&
.
cache!
}
rescue
=>
e
if
Rails
.
env
.
production?
Rails
.
logger
.
warn
(
"Cached record for
#{
name
}
couldn't be loaded, falling back to uncached record:
#{
e
}
"
)
# rubocop:disable Gitlab/RailsLogger
Gitlab
::
AppLogger
.
warn
(
"Cached record for
#{
name
}
couldn't be loaded, falling back to uncached record:
#{
e
}
"
)
else
raise
e
end
...
...
app/models/concerns/update_highest_role.rb
View file @
76f526a9
...
...
@@ -29,9 +29,7 @@ module UpdateHighestRole
UpdateHighestRoleWorker
.
perform_in
(
HIGHEST_ROLE_JOB_DELAY
,
update_highest_role_attribute
)
else
# use same logging as ExclusiveLeaseGuard
# rubocop:disable Gitlab/RailsLogger
Rails
.
logger
.
error
(
'Cannot obtain an exclusive lease. There must be another instance already in execution.'
)
# rubocop:enable Gitlab/RailsLogger
Gitlab
::
AppLogger
.
error
(
'Cannot obtain an exclusive lease. There must be another instance already in execution.'
)
end
end
end
...
...
changelogs/unreleased/rails-logger-cop-6.yml
0 → 100644
View file @
76f526a9
---
title
:
Use applogger in cache attrs and highest role ruby files
merge_request
:
32189
author
:
Rajendra Kadam
type
:
fixed
spec/models/concerns/cacheable_attributes_spec.rb
View file @
76f526a9
...
...
@@ -135,7 +135,7 @@ describe CacheableAttributes do
end
it
'returns an uncached record and logs a warning'
do
expect
(
Rails
.
l
ogger
).
to
receive
(
:warn
).
with
(
"Cached record for TestClass couldn't be loaded, falling back to uncached record: Redis::BaseError"
)
expect
(
Gitlab
::
AppL
ogger
).
to
receive
(
:warn
).
with
(
"Cached record for TestClass couldn't be loaded, falling back to uncached record: Redis::BaseError"
)
expect
(
MinimalTestClass
.
current
).
to
eq
(
:last
)
end
...
...
@@ -147,7 +147,7 @@ describe CacheableAttributes do
end
it
'returns an uncached record and logs a warning'
do
expect
(
Rails
.
l
ogger
).
not_to
receive
(
:warn
)
expect
(
Gitlab
::
AppL
ogger
).
not_to
receive
(
:warn
)
expect
{
MinimalTestClass
.
current
}.
to
raise_error
(
Redis
::
BaseError
)
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