##// END OF EJS Templates
automation: updated update task to update repositories and groups....
dan -
r4160:7447e8d1 default
parent child Browse files
Show More
@@ -35,7 +35,8 b' from rhodecode.lib import audit_logger'
35 35 from rhodecode.lib.celerylib import get_logger, async_task, RequestContextTask
36 36 from rhodecode.lib.hooks_base import log_create_repository
37 37 from rhodecode.lib.utils2 import safe_int, str2bool
38 from rhodecode.model.db import Session, IntegrityError, Repository, User, true
38 from rhodecode.model.db import (
39 Session, IntegrityError, true, Repository, RepoGroup, User)
39 40
40 41
41 42 @async_task(ignore_result=True, base=RequestContextTask)
@@ -344,6 +345,21 b' def beat_check(*args, **kwargs):'
344 345
345 346
346 347 @async_task(ignore_result=True)
347 def sync_repo_groups_last_update(*args, **kwargs):
348 from rhodecode.model.repo_group import RepoGroupModel
349 return RepoGroupModel().update_commit_cache()
348 def sync_last_update(*args, **kwargs):
349
350 skip_repos = kwargs.get('skip_repos')
351 if not skip_repos:
352 repos = Repository.query() \
353 .order_by(Repository.group_id.asc())
354
355 for repo in repos:
356 repo.update_commit_cache()
357
358 skip_groups = kwargs.get('skip_groups')
359 if not skip_groups:
360 repo_groups = RepoGroup.query() \
361 .filter(RepoGroup.group_parent_id == None)
362
363 for root_gr in repo_groups:
364 for repo_gr in reversed(root_gr.recursive_groups()):
365 repo_gr.update_commit_cache()
General Comments 0
You need to be logged in to leave comments. Login now