Geo: repository is updated but displays old cached data in Web UI
Summary
GitLab Geo (#76) is not expiring caches for important changes to display in Web UI in a secondary node.
Steps to reproduce
A few examples of failing scenarios:
Scenario 1 - New projects
- Create a project in primary node
- Access the new project in secondary node (you will get a warning that there is no repository yet: see #1071 (closed))
- Push some code to primary node
- Go back to secondary node (you still get a warning that there is no repository)
- If you go to the Activity Tab you see the commit and if you click at the hash you see the content
The issue here is that repository.exists?
is cached and never expired
Scenario 2 - README
- Create a project in primary node
- Push a new README file in primary node
- Access the new project in secondary node (you will see the README content there)
- Update the READM file in primary node
- Go back to secondary node and refresh (you will never see the updated README rendered in frontpage, but you can see if you go to the file listing).
The issue here is that repository.readme
is also cached
The list goes on and on.
Expected behavior
Whenever something is updated we should be able to see fresh content in secondary nodes.
Actual behavior
We only get "fresh" content when it's not cached (so newly visited urls)
Possible fixes
Whenever we update the project we should mimic the same cache expiration algorithm or always try to clear whole project cache if it's too difficult to reliably replicate the same behavior.
Important files to check:
app/models/repository.rb
app/workers/project_cache_worker.rb
app/services/git_push_service.rb