Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
2add4ed409d1
Commit
2add4ed4
authored
Aug 29, 2013
by
Dmitriy Zaporozhets
Browse files
Invalidate events cache when project was moved
parent
d3a0fa76d8e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
2add4ed4
...
...
@@ -423,6 +423,7 @@
gitlab_shell
.
rm_satellites
(
old_path_with_namespace
)
ensure_satellite_exists
send_move_instructions
reset_events_cache
rescue
# Returning false does not rollback after_* transaction but gives
# us information about failing some of tasks
...
...
@@ -434,4 +435,19 @@
raise
Exception
.
new
(
'repository cannot be renamed'
)
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
app/services/project_transfer_service.rb
View file @
2add4ed4
...
...
@@ -32,6 +32,9 @@
# create satellite repo
project
.
ensure_satellite_exists
# clear project cached events
project
.
reset_events_cache
true
end
end
...
...
Write
Preview
Supports
Markdown
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