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
c0fae635
Commit
c0fae635
authored
Apr 20, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Elastic][Fix] Database indexer skips empty projects
parent
75136cc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
CHANGELOG-EE
CHANGELOG-EE
+1
-0
lib/tasks/gitlab/elastic.rake
lib/tasks/gitlab/elastic.rake
+8
-6
No files found.
CHANGELOG-EE
View file @
c0fae635
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.8.0 (unreleased)
- [Elastic] Database indexer prints its status
- [Elastic][Fix] Database indexer skips projects with invalid HEAD reference
v 8.7.0
- Update GitLab Pages to 0.2.1: support user-defined 404 pages
...
...
lib/tasks/gitlab/elastic.rake
View file @
c0fae635
...
...
@@ -24,28 +24,30 @@ namespace :gitlab do
indexer
=
Elastic
::
Indexer
.
new
projects
.
find_each
do
|
project
|
if
project
.
repository
.
exists?
&&
!
project
.
repository
.
empty?
repository
=
project
.
repository
if
repository
.
exists?
&&
!
repository
.
empty?
puts
"Indexing
#{
project
.
name_with_namespace
}
(ID=
#{
project
.
id
}
)..."
index_status
=
IndexStatus
.
find_or_create_by
(
project:
project
)
begin
head_
sha
=
project
.
repository
.
commit
.
sha
head_
commit
=
repository
.
commit
if
index_status
.
last_commit
==
head_
sha
if
!
head_commit
||
index_status
.
last_commit
==
head_commit
.
sha
puts
"Skipped"
.
yellow
next
end
indexer
.
run
(
project
.
id
,
project
.
repository
.
path_to_repo
,
project
.
index_status
.
last_commit
repository
.
path_to_repo
,
index_status
.
last_commit
)
# During indexing the new commits can be pushed,
# the last_commit parameter only indicates that at least this commit is in index
index_status
.
update
(
last_commit:
head_sha
,
indexed_at:
DateTime
.
now
)
index_status
.
update
(
last_commit:
head_
commit
.
sha
,
indexed_at:
DateTime
.
now
)
puts
"Done!"
.
green
rescue
StandardError
=>
e
puts
"
#{
e
.
message
}
, trace -
#{
e
.
backtrace
}
"
...
...
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