Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
f893fbaa
Commit
f893fbaa
authored
Jun 23, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update PostReceive worker to provide enqueued_at time
parent
c6f14956
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
CHANGELOG
CHANGELOG
+3
-0
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+6
-1
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+3
-1
No files found.
CHANGELOG
View file @
f893fbaa
v3.0.1
- Update PostReceive worker to provide enqueued_at time.
v3.0.0
- Remove rm-tag command (Robert Schilling)
- Remove create-branch and rm-branch commands (Robert Schilling)
...
...
lib/gitlab_post_receive.rb
View file @
f893fbaa
...
...
@@ -73,7 +73,12 @@ class GitlabPostReceive
changes
=
Base64
.
encode64
(
@changes
)
queue
=
"
#{
config
.
redis_namespace
}
:queue:post_receive"
msg
=
JSON
.
dump
({
'class'
=>
'PostReceive'
,
'args'
=>
[
@repo_path
,
@actor
,
changes
],
'jid'
=>
@jid
})
msg
=
JSON
.
dump
({
'class'
=>
'PostReceive'
,
'args'
=>
[
@repo_path
,
@actor
,
changes
],
'jid'
=>
@jid
,
'enqueued_at'
=>
Time
.
now
.
to_f
})
begin
GitlabNet
.
new
.
redis_client
.
rpush
(
queue
,
msg
)
...
...
spec/gitlab_post_receive_spec.rb
View file @
f893fbaa
...
...
@@ -13,10 +13,12 @@ describe GitlabPostReceive do
let
(
:gitlab_post_receive
)
{
GitlabPostReceive
.
new
(
repo_path
,
actor
,
wrongly_encoded_changes
)
}
let
(
:message
)
{
"test "
*
10
+
"message "
*
10
}
let
(
:redis_client
)
{
double
(
'redis_client'
)
}
let
(
:enqueued_at
)
{
Time
.
new
(
2016
,
6
,
23
,
6
,
59
)
}
before
do
GitlabConfig
.
any_instance
.
stub
(
repos_path:
repository_path
)
GitlabNet
.
any_instance
.
stub
(
broadcast_message:
{
"message"
=>
message
})
expect
(
Time
).
to
receive
(
:now
).
and_return
(
enqueued_at
)
end
describe
"#exec"
do
...
...
@@ -51,7 +53,7 @@ describe GitlabPostReceive do
it
"pushes a Sidekiq job onto the queue"
do
expect
(
redis_client
).
to
receive
(
:rpush
).
with
(
'resque:gitlab:queue:post_receive'
,
%Q/{"class":"PostReceive","args":["
#{
repo_path
}
","
#{
actor
}
",
#{
base64_changes
.
inspect
}
],"jid":"
#{
gitlab_post_receive
.
jid
}
"}/
%Q/{"class":"PostReceive","args":["
#{
repo_path
}
","
#{
actor
}
",
#{
base64_changes
.
inspect
}
],"jid":"
#{
gitlab_post_receive
.
jid
}
"
,"enqueued_at":
#{
enqueued_at
.
to_f
}
}/
).
and_return
(
true
)
gitlab_post_receive
.
exec
...
...
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