Show More
@@ -705,7 +705,9 b' class HomeView(BaseAppView):' | |||||
705 | c.repo_group = self.request.db_repo_group |
|
705 | c.repo_group = self.request.db_repo_group | |
706 | repo_data, repo_group_data = self._get_groups_and_repos(c.repo_group.group_id) |
|
706 | repo_data, repo_group_data = self._get_groups_and_repos(c.repo_group.group_id) | |
707 |
|
707 | |||
708 | c.repo_group.update_commit_cache() |
|
708 | # update every 5 min | |
|
709 | if self.request.db_repo_group.last_commit_cache_update_diff > 60 * 5: | |||
|
710 | self.request.db_repo_group.update_commit_cache() | |||
709 |
|
711 | |||
710 | # json used to render the grids |
|
712 | # json used to render the grids | |
711 | c.repos_data = json.dumps(repo_data) |
|
713 | c.repos_data = json.dumps(repo_data) |
@@ -202,6 +202,10 b' class RepoSummaryView(RepoAppView):' | |||||
202 | # Prepare the clone URL |
|
202 | # Prepare the clone URL | |
203 | self._prepare_and_set_clone_url(c) |
|
203 | self._prepare_and_set_clone_url(c) | |
204 |
|
204 | |||
|
205 | # update every 5 min | |||
|
206 | if self.db_repo.last_commit_cache_update_diff > 60 * 5: | |||
|
207 | self.db_repo.update_commit_cache() | |||
|
208 | ||||
205 | # If enabled, get statistics data |
|
209 | # If enabled, get statistics data | |
206 |
|
210 | |||
207 | c.show_stats = bool(self.db_repo.enable_statistics) |
|
211 | c.show_stats = bool(self.db_repo.enable_statistics) |
@@ -214,6 +214,7 b' class _ToolTip(object):' | |||||
214 | tooltip_title = escape(tooltip_title) |
|
214 | tooltip_title = escape(tooltip_title) | |
215 | tooltip_title = tooltip_title.replace('<', '<').replace('>', '>') |
|
215 | tooltip_title = tooltip_title.replace('<', '<').replace('>', '>') | |
216 | return tooltip_title |
|
216 | return tooltip_title | |
|
217 | ||||
217 | tooltip = _ToolTip() |
|
218 | tooltip = _ToolTip() | |
218 |
|
219 | |||
219 |
|
220 |
@@ -2185,6 +2185,10 b' class Repository(Base, BaseModel):' | |||||
2185 | return make_lock, currently_locked, lock_info |
|
2185 | return make_lock, currently_locked, lock_info | |
2186 |
|
2186 | |||
2187 | @property |
|
2187 | @property | |
|
2188 | def last_commit_cache_update_diff(self): | |||
|
2189 | return time.time() - (safe_int(self.changeset_cache.get('updated_on')) or 0) | |||
|
2190 | ||||
|
2191 | @property | |||
2188 | def last_commit_change(self): |
|
2192 | def last_commit_change(self): | |
2189 | from rhodecode.lib.vcs.utils.helpers import parse_datetime |
|
2193 | from rhodecode.lib.vcs.utils.helpers import parse_datetime | |
2190 | empty_date = datetime.datetime.fromtimestamp(0) |
|
2194 | empty_date = datetime.datetime.fromtimestamp(0) | |
@@ -2295,6 +2299,7 b' class Repository(Base, BaseModel):' | |||||
2295 | message |
|
2299 | message | |
2296 | date |
|
2300 | date | |
2297 | author |
|
2301 | author | |
|
2302 | updated_on | |||
2298 |
|
2303 | |||
2299 | """ |
|
2304 | """ | |
2300 | from rhodecode.lib.vcs.backends.base import BaseChangeset |
|
2305 | from rhodecode.lib.vcs.backends.base import BaseChangeset | |
@@ -2330,6 +2335,7 b' class Repository(Base, BaseModel):' | |||||
2330 | if last_change_timestamp > current_timestamp: |
|
2335 | if last_change_timestamp > current_timestamp: | |
2331 | cs_cache['date'] = _default |
|
2336 | cs_cache['date'] = _default | |
2332 |
|
2337 | |||
|
2338 | cs_cache['updated_on'] = time.time() | |||
2333 | self.changeset_cache = cs_cache |
|
2339 | self.changeset_cache = cs_cache | |
2334 | Session().add(self) |
|
2340 | Session().add(self) | |
2335 | Session().commit() |
|
2341 | Session().commit() | |
@@ -2671,6 +2677,10 b' class RepoGroup(Base, BaseModel):' | |||||
2671 | return groups |
|
2677 | return groups | |
2672 |
|
2678 | |||
2673 | @property |
|
2679 | @property | |
|
2680 | def last_commit_cache_update_diff(self): | |||
|
2681 | return time.time() - (safe_int(self.changeset_cache.get('updated_on')) or 0) | |||
|
2682 | ||||
|
2683 | @property | |||
2674 | def last_commit_change(self): |
|
2684 | def last_commit_change(self): | |
2675 | from rhodecode.lib.vcs.utils.helpers import parse_datetime |
|
2685 | from rhodecode.lib.vcs.utils.helpers import parse_datetime | |
2676 | empty_date = datetime.datetime.fromtimestamp(0) |
|
2686 | empty_date = datetime.datetime.fromtimestamp(0) | |
@@ -2817,6 +2827,7 b' class RepoGroup(Base, BaseModel):' | |||||
2817 | latest_repo_cs_cache = repo_cs_cache |
|
2827 | latest_repo_cs_cache = repo_cs_cache | |
2818 | latest_repo_cs_cache['source_repo_id'] = repo.repo_id |
|
2828 | latest_repo_cs_cache['source_repo_id'] = repo.repo_id | |
2819 |
|
2829 | |||
|
2830 | latest_repo_cs_cache['updated_on'] = time.time() | |||
2820 | repo_group.changeset_cache = latest_repo_cs_cache |
|
2831 | repo_group.changeset_cache = latest_repo_cs_cache | |
2821 | Session().add(repo_group) |
|
2832 | Session().add(repo_group) | |
2822 | Session().commit() |
|
2833 | Session().commit() |
General Comments 0
You need to be logged in to leave comments.
Login now