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
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
Tatuya Kamada
gitlab-ce
Commits
8315f363
Commit
8315f363
authored
Aug 29, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/reset_event_cache' of /home/git/repositories/gitlab/gitlabhq
parents
ffb0ad93
99eefcb5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
app/models/project.rb
app/models/project.rb
+16
-0
app/services/project_transfer_service.rb
app/services/project_transfer_service.rb
+3
-0
No files found.
app/models/project.rb
View file @
8315f363
...
@@ -423,6 +423,7 @@ class Project < ActiveRecord::Base
...
@@ -423,6 +423,7 @@ class Project < ActiveRecord::Base
gitlab_shell
.
rm_satellites
(
old_path_with_namespace
)
gitlab_shell
.
rm_satellites
(
old_path_with_namespace
)
ensure_satellite_exists
ensure_satellite_exists
send_move_instructions
send_move_instructions
reset_events_cache
rescue
rescue
# Returning false does not rollback after_* transaction but gives
# Returning false does not rollback after_* transaction but gives
# us information about failing some of tasks
# us information about failing some of tasks
...
@@ -434,4 +435,19 @@ class Project < ActiveRecord::Base
...
@@ -434,4 +435,19 @@ class Project < ActiveRecord::Base
raise
Exception
.
new
(
'repository cannot be renamed'
)
raise
Exception
.
new
(
'repository cannot be renamed'
)
end
end
end
end
# Reset events cache related to this project
#
# Since we do cache @event we need to reset cache in special cases:
# * when project was moved
# * when project was renamed
# Events cache stored like events/23-20130109142513.
# The cache key includes updated_at timestamp.
# Thus it will automatically generate a new fragment
# when the event is updated because the key changes.
def
reset_events_cache
Event
.
where
(
project_id:
self
.
id
).
order
(
'id DESC'
).
limit
(
100
).
update_all
(
updated_at:
Time
.
now
)
end
end
end
app/services/project_transfer_service.rb
View file @
8315f363
...
@@ -32,6 +32,9 @@ class ProjectTransferService
...
@@ -32,6 +32,9 @@ class ProjectTransferService
# create satellite repo
# create satellite repo
project
.
ensure_satellite_exists
project
.
ensure_satellite_exists
# clear project cached events
project
.
reset_events_cache
true
true
end
end
end
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