tasks.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:invenio-github 作者: inveniosoftware 项目源码 文件源码
def sync_hooks(user_id, repositories):
    """Sync repository hooks for a user."""
    from .api import GitHubAPI

    try:
        # Sync hooks
        gh = GitHubAPI(user_id=user_id)
        for repo_id in repositories:
            try:
                with db.session.begin_nested():
                    gh.sync_repo_hook(repo_id)
                # We commit per repository, because while the task is running
                # the user might enable/disable a hook.
                db.session.commit()
            except (NoResultFound, RepositoryAccessError) as e:
                current_app.logger.warning(e.message, exc_info=True)
    except Exception as exc:
        sync_hooks.retry(exc=exc)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号