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
20dbc7cf
Commit
20dbc7cf
authored
Dec 02, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Guard pages legacy storage lease by feature flag
parent
7431644b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
app/services/pages/legacy_storage_lease.rb
app/services/pages/legacy_storage_lease.rb
+9
-0
config/feature_flags/development/pages_use_legacy_storage_lease.yml
...ture_flags/development/pages_use_legacy_storage_lease.yml
+8
-0
spec/services/pages/legacy_storage_lease_spec.rb
spec/services/pages/legacy_storage_lease_spec.rb
+10
-2
No files found.
app/services/pages/legacy_storage_lease.rb
View file @
20dbc7cf
...
...
@@ -8,6 +8,15 @@ module Pages
LEASE_TIMEOUT
=
1
.
hour
# override method from exclusive lease guard to guard it by feature flag
# TODO: just remove this method after testing this in production
# https://gitlab.com/gitlab-org/gitlab/-/issues/282464
def
try_obtain_lease
return
yield
unless
Feature
.
enabled?
(
:pages_use_legacy_storage_lease
,
project
)
super
end
def
lease_key
"pages_legacy_storage:
#{
project
.
id
}
"
end
...
...
config/feature_flags/development/pages_use_legacy_storage_lease.yml
0 → 100644
View file @
20dbc7cf
---
name
:
pages_use_legacy_storage_lease
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48349
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/282464
milestone
:
'
13.7'
type
:
development
group
:
group::release
default_enabled
:
false
spec/services/pages/legacy_storage_lease_spec.rb
View file @
20dbc7cf
...
...
@@ -30,9 +30,9 @@ RSpec.describe ::Pages::LegacyStorageLease do
let
(
:service
)
{
implementation
.
new
(
project
)
}
it
'allows method to be executed'
do
expect
(
service
).
to
receive
:execute_unsafe
expect
(
service
).
to
receive
(
:execute_unsafe
).
and_call_original
service
.
execute
expect
(
service
.
execute
).
to
eq
(
true
)
end
context
'when another service holds the lease for the same project'
do
...
...
@@ -47,6 +47,14 @@ RSpec.describe ::Pages::LegacyStorageLease do
expect
(
service
.
execute
).
to
eq
(
nil
)
end
it
'runs guarded method if feature flag is disabled'
do
stub_feature_flags
(
pages_use_legacy_storage_lease:
false
)
expect
(
service
).
to
receive
(
:execute_unsafe
).
and_call_original
expect
(
service
.
execute
).
to
eq
(
true
)
end
end
context
'when another service holds the lease for the different project'
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