##// END OF EJS Templates
tasks: added a periodic task for repo maintenance. Fixes #5202
marcink -
r2432:d1e95a71 default
parent child Browse files
Show More
@@ -279,6 +279,21 b' def sync_repo(*args, **kwargs):'
279
279
280
280
281 @async_task(ignore_result=True)
281 @async_task(ignore_result=True)
282 def repo_maintenance(repoid):
283 from rhodecode.lib import repo_maintenance as repo_maintenance_lib
284 log = get_logger(repo_maintenance)
285 repo = Repository.get_by_id_or_repo_name(repoid)
286 if repo:
287 maintenance = repo_maintenance_lib.RepoMaintenance()
288 tasks = maintenance.get_tasks_for_repo(repo)
289 log.debug('Executing %s tasks on repo `%s`', tasks, repoid)
290 executed_types = maintenance.execute(repo)
291 log.debug('Got execution results %s', executed_types)
292 else:
293 log.debug('Repo `%s` not found or without a clone_url', repoid)
294
295
296 @async_task(ignore_result=True)
282 def check_for_update():
297 def check_for_update():
283 from rhodecode.model.update import UpdateModel
298 from rhodecode.model.update import UpdateModel
284 update_url = UpdateModel().get_update_url()
299 update_url = UpdateModel().get_update_url()
@@ -1725,6 +1725,17 b' class Repository(Base, BaseModel):'
1725 return q.scalar()
1725 return q.scalar()
1726
1726
1727 @classmethod
1727 @classmethod
1728 def get_by_id_or_repo_name(cls, repoid):
1729 if isinstance(repoid, (int, long)):
1730 try:
1731 repo = cls.get(repoid)
1732 except ValueError:
1733 repo = None
1734 else:
1735 repo = cls.get_by_repo_name(repoid)
1736 return repo
1737
1738 @classmethod
1728 def get_by_full_path(cls, repo_full_path):
1739 def get_by_full_path(cls, repo_full_path):
1729 repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
1740 repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
1730 repo_name = cls.normalize_repo_name(repo_name)
1741 repo_name = cls.normalize_repo_name(repo_name)
General Comments 0
You need to be logged in to leave comments. Login now