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
f7d2bd0b
Commit
f7d2bd0b
authored
Dec 01, 2021
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore info command for multistore method missing
- Fix block for anonymous session
parent
574144e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
13 deletions
+33
-13
lib/gitlab/anonymous_session.rb
lib/gitlab/anonymous_session.rb
+3
-3
lib/gitlab/redis/multi_store.rb
lib/gitlab/redis/multi_store.rb
+4
-0
spec/lib/gitlab/redis/multi_store_spec.rb
spec/lib/gitlab/redis/multi_store_spec.rb
+26
-10
No files found.
lib/gitlab/anonymous_session.rb
View file @
f7d2bd0b
...
...
@@ -10,9 +10,9 @@ module Gitlab
def
count_session_ip
redis_store_class
.
with
do
|
redis
|
redis
.
pipelined
do
redis
.
incr
(
session_lookup_name
)
redis
.
expire
(
session_lookup_name
,
24
.
hours
)
redis
.
pipelined
do
|
pipeline
|
pipeline
.
incr
(
session_lookup_name
)
pipeline
.
expire
(
session_lookup_name
,
24
.
hours
)
end
end
end
...
...
lib/gitlab/redis/multi_store.rb
View file @
f7d2bd0b
...
...
@@ -21,6 +21,8 @@ module Gitlab
FAILED_TO_READ_ERROR_MESSAGE
=
'Failed to read from the redis primary_store.'
FAILED_TO_WRITE_ERROR_MESSAGE
=
'Failed to write to the redis primary_store.'
SKIP_LOG_METHOD_MISSING_FOR_COMMANDS
=
%i(info)
.
freeze
READ_COMMANDS
=
%i(
get
mget
...
...
@@ -109,6 +111,8 @@ module Gitlab
end
def
log_method_missing
(
command_name
,
*
_args
)
return
if
SKIP_LOG_METHOD_MISSING_FOR_COMMANDS
.
include?
(
command_name
)
log_error
(
MethodMissingError
.
new
,
command_name
)
increment_method_missing_count
(
command_name
)
end
...
...
spec/lib/gitlab/redis/multi_store_spec.rb
View file @
f7d2bd0b
...
...
@@ -478,9 +478,7 @@ RSpec.describe Gitlab::Redis::MultiStore do
let_it_be
(
:key
)
{
"redis:counter"
}
subject
do
multi_store
.
incr
(
key
)
end
subject
{
multi_store
.
incr
(
key
)
}
it
'executes method missing'
do
expect
(
multi_store
).
to
receive
(
:method_missing
)
...
...
@@ -488,17 +486,35 @@ RSpec.describe Gitlab::Redis::MultiStore do
subject
end
it
'logs MethodMissingError'
do
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:log_exception
).
with
(
an_instance_of
(
Gitlab
::
Redis
::
MultiStore
::
MethodMissingError
),
hash_including
(
command_name: :incr
,
extra:
hash_including
(
instance_name:
instance_name
)))
context
'when command is not in SKIP_LOG_METHOD_MISSING_FOR_COMMANDS'
do
it
'logs MethodMissingError'
do
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:log_exception
).
with
(
an_instance_of
(
Gitlab
::
Redis
::
MultiStore
::
MethodMissingError
),
hash_including
(
command_name: :incr
,
extra:
hash_including
(
instance_name:
instance_name
)))
subject
subject
end
it
'increments method missing counter'
do
expect
(
counter
).
to
receive
(
:increment
).
with
(
command: :incr
,
instance_name:
instance_name
)
subject
end
end
it
'increments method missing counter
'
do
expect
(
counter
).
to
receive
(
:increment
).
with
(
command: :incr
,
instance_name:
instance_name
)
context
'when command is in SKIP_LOG_METHOD_MISSING_FOR_COMMANDS
'
do
subject
{
multi_store
.
info
}
subject
it
'does not log MethodMissingError'
do
expect
(
Gitlab
::
ErrorTracking
).
not_to
receive
(
:log_exception
)
subject
end
it
'does not increment method missing counter'
do
expect
(
counter
).
not_to
receive
(
:increment
)
subject
end
end
context
'with feature flag :use_primary_store_as_default_for_test_store is enabled'
do
...
...
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