enable_long_polling.py 文件源码

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

项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码
def database_changed(sender, **kwargs):
    table_name = sender._meta.db_table

    if table_name.startswith('chroma_core'):                    # We are only interested in our tables, not the django ones.
        using = kwargs.pop('using', DEFAULT_DB_ALIAS)

        if transaction.is_managed(using) is False:              # Not a managed transaction so the change has occurred
            log.debug('Propagating tablechange for %s' % table_name)
            _propagate_table_change([table_name])
        else:                                                   # This is a transaction and until it commits it has not happened
            with operation_lock:
                if using not in _pending_table_changes:
                    log.debug('New transaction change %s using %s' % (table_name, using))

                    original_commit_fn = transaction.connections[using].commit
                    original_rollback_fn = transaction.connections[using].rollback

                    transaction.connections[using].commit = lambda: _transaction_commit_rollback(using,
                                                                                                 True,
                                                                                                 original_commit_fn,
                                                                                                 original_rollback_fn)

                    transaction.connections[using].rollback = lambda: _transaction_commit_rollback(using,
                                                                                                   False,
                                                                                                   original_commit_fn,
                                                                                                   original_rollback_fn)

                log.debug('Adding pending change %s using %s' % (table_name, using))
                _pending_table_changes[using].add(table_name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号