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
da480ca2
Commit
da480ca2
authored
Aug 31, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove memoization on processing ref changes
parent
a7e0fc7f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
10 deletions
+25
-10
app/services/git/process_ref_changes_service.rb
app/services/git/process_ref_changes_service.rb
+5
-3
changelogs/unreleased/id-remove-memoize-on-processing-ref-changes.yml
...nreleased/id-remove-memoize-on-processing-ref-changes.yml
+5
-0
spec/services/git/process_ref_changes_service_spec.rb
spec/services/git/process_ref_changes_service_spec.rb
+15
-7
No files found.
app/services/git/process_ref_changes_service.rb
View file @
da480ca2
...
...
@@ -42,7 +42,7 @@ module Git
push_service_class
=
push_service_class_for
(
ref_type
)
create_bulk_push_event
=
changes
.
size
>
Gitlab
::
CurrentSettings
.
push_event_activities_limit
merge_request_branches
=
merge_request_branches_for
(
changes
)
merge_request_branches
=
merge_request_branches_for
(
ref_type
,
changes
)
changes
.
each
do
|
change
|
push_service_class
.
new
(
...
...
@@ -74,8 +74,10 @@ module Git
Git
::
BranchPushService
end
def
merge_request_branches_for
(
changes
)
@merge_requests_branches
||=
MergeRequests
::
PushedBranchesService
.
new
(
project
,
current_user
,
changes:
changes
).
execute
def
merge_request_branches_for
(
ref_type
,
changes
)
return
[]
if
ref_type
==
:tag
MergeRequests
::
PushedBranchesService
.
new
(
project
,
current_user
,
changes:
changes
).
execute
end
end
end
changelogs/unreleased/id-remove-memoize-on-processing-ref-changes.yml
0 → 100644
View file @
da480ca2
---
title
:
Fix wrong caching logic in ProcessRefChangesService
merge_request
:
40821
author
:
type
:
fixed
spec/services/git/process_ref_changes_service_spec.rb
View file @
da480ca2
...
...
@@ -172,23 +172,31 @@ RSpec.describe Git::ProcessRefChangesService do
[
{
index:
0
,
oldrev:
Gitlab
::
Git
::
BLANK_SHA
,
newrev:
'789012'
,
ref:
"
#{
ref_prefix
}
/create1"
},
{
index:
1
,
oldrev:
Gitlab
::
Git
::
BLANK_SHA
,
newrev:
'789013'
,
ref:
"
#{
ref_prefix
}
/create2"
},
{
index:
2
,
oldrev:
Gitlab
::
Git
::
BLANK_SHA
,
newrev:
'789014'
,
ref:
"
#{
ref_prefix
}
/create3"
}
{
index:
2
,
oldrev:
Gitlab
::
Git
::
BLANK_SHA
,
newrev:
'789014'
,
ref:
"
#{
ref_prefix
}
/create3"
},
{
index:
3
,
oldrev:
'789015'
,
newrev:
'789016'
,
ref:
"
#{
ref_prefix
}
/changed1"
},
{
index:
4
,
oldrev:
'789017'
,
newrev:
'789018'
,
ref:
"
#{
ref_prefix
}
/changed2"
},
{
index:
5
,
oldrev:
'789019'
,
newrev:
Gitlab
::
Git
::
BLANK_SHA
,
ref:
"
#{
ref_prefix
}
/removed1"
},
{
index:
6
,
oldrev:
'789020'
,
newrev:
Gitlab
::
Git
::
BLANK_SHA
,
ref:
"
#{
ref_prefix
}
/removed2"
}
]
end
let
(
:git_changes
)
{
double
(
branch_changes:
branch_changes
,
tag_changes:
tag_changes
)
}
it
'schedules job for existing merge requests'
do
expect_next_instance_of
(
MergeRequests
::
PushedBranchesService
)
do
|
service
|
expect
(
service
).
to
receive
(
:execute
).
and_return
(
%w(create1 create2)
)
end
before
do
allow
(
MergeRequests
::
PushedBranchesService
).
to
receive
(
:new
).
and_return
(
double
(
execute:
%w(create1 create2)
),
double
(
execute:
%w(changed1)
),
double
(
execute:
%w(removed2)
)
)
end
it
'schedules job for existing merge requests'
do
expect
(
UpdateMergeRequestsWorker
).
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
user
.
id
,
Gitlab
::
Git
::
BLANK_SHA
,
'789012'
,
"
#{
ref_prefix
}
/create1"
).
ordered
expect
(
UpdateMergeRequestsWorker
).
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
user
.
id
,
Gitlab
::
Git
::
BLANK_SHA
,
'789013'
,
"
#{
ref_prefix
}
/create2"
).
ordered
expect
(
UpdateMergeRequestsWorker
).
not_to
receive
(
:perform_async
)
.
with
(
project
.
id
,
user
.
id
,
Gitlab
::
Git
::
BLANK_SHA
,
'789014'
,
"
#{
ref_prefix
}
/create3"
).
ordered
expect
(
UpdateMergeRequestsWorker
).
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
user
.
id
,
'789015'
,
'789016'
,
"
#{
ref_prefix
}
/changed1"
).
ordered
expect
(
UpdateMergeRequestsWorker
).
to
receive
(
:perform_async
)
.
with
(
project
.
id
,
user
.
id
,
'789020'
,
Gitlab
::
Git
::
BLANK_SHA
,
"
#{
ref_prefix
}
/removed2"
).
ordered
subject
.
execute
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