Mercurial > libervia-backend
view sat/memory/migration/versions/79e5f3313fa4_create_table_for_pubsub_subscriptions.py @ 3914:4cb38c8312a1
plugin XEP-0384, xml_tools: avoid `getItems` timeout + fix empty node crash + parsing:
- use `max_items` in `getItems` calls for bundles, as otherwise some pubsub service may
return full nodes, which may be huge is `max_items=1` is not set on the node, possibly
resulting in timeouts.
- the plugin was crashing when TWOMEMO devices list node has no items at all. This is not
the case anymore.
- a naive parsing method has been implemented in `xml_tools` to replace the
serialisation/deserialisation method. This should be more efficient and will avoid
annoying `ns0:` prefixes in XML logs.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 24 Sep 2022 16:37:46 +0200 |
parents | 658ddbabaf36 |
children |
line wrap: on
line source
"""create table for pubsub subscriptions Revision ID: 79e5f3313fa4 Revises: 129ac51807e4 Create Date: 2022-03-14 17:15:00.689871 """ from alembic import op import sqlalchemy as sa from sat.memory.sqla_mapping import JID # revision identifiers, used by Alembic. revision = '79e5f3313fa4' down_revision = '129ac51807e4' branch_labels = None depends_on = None def upgrade(): op.create_table('pubsub_subs', sa.Column('id', sa.Integer(), nullable=False), sa.Column('node_id', sa.Integer(), nullable=False), sa.Column('subscriber', JID(), nullable=True), sa.Column('state', sa.Enum('SUBSCRIBED', 'PENDING', name='state'), nullable=True), sa.ForeignKeyConstraint(['node_id'], ['pubsub_nodes.id'], name=op.f('fk_pubsub_subs_node_id_pubsub_nodes'), ondelete='CASCADE'), sa.PrimaryKeyConstraint('id', name=op.f('pk_pubsub_subs')), sa.UniqueConstraint('node_id', 'subscriber', name=op.f('uq_pubsub_subs_node_id')) ) def downgrade(): op.drop_table('pubsub_subs')