summaryrefslogtreecommitdiff
path: root/contrib/ast-db-manage
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-06-22 15:25:23 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-06-22 15:29:50 -0400
commit6fa3ed067957e580e208ead7a62a095ac26f5fa9 (patch)
tree7d48f6d6631bcc8ca17f05f18fbd392da414b3f4 /contrib/ast-db-manage
parentaec09d9c09f04c886b15c731faee9f8d4fb9833f (diff)
res_pjsip: improve realtime performance #2
The patch removes updating all Endpoints' status on startup. Instead, only non-qualified aors with static contact and non-qualified non-expired contacts are retrieved from the realtime to update the endpoint status to ONLINE. The endpoint name was added to the contact object to simply find the endpoint that created this contact. The status of endpoints with qualified aors will be updated by 'qualify' functions. ASTERISK-26061 #close Change-Id: Id324c1776fa55d3741e0c5457ecac0304cb1a0df
Diffstat (limited to 'contrib/ast-db-manage')
-rw-r--r--contrib/ast-db-manage/config/versions/ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/contrib/ast-db-manage/config/versions/ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.py b/contrib/ast-db-manage/config/versions/ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.py
new file mode 100644
index 000000000..ff1834329
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/ef7efc2d3964_ps_contacts_add_endpoint_and_modify_.py
@@ -0,0 +1,33 @@
+"""ps_contacts add endpoint and modify expiration_time to bigint
+
+Revision ID: ef7efc2d3964
+Revises: a845e4d8ade8
+Create Date: 2016-06-02 18:18:46.231920
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'ef7efc2d3964'
+down_revision = 'a845e4d8ade8'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+ context = op.get_context()
+
+ op.add_column('ps_contacts', sa.Column('endpoint', sa.String(40)))
+
+ if context.bind.dialect.name != 'postgresql':
+ op.alter_column('ps_contacts', 'expiration_time', type_=sa.BigInteger)
+ else:
+ op.execute('ALTER TABLE ps_contacts ALTER COLUMN expiration_time TYPE BIGINT USING expiration_time::bigint')
+
+ op.create_index('ps_contacts_qualifyfreq_exptime', 'ps_contacts', ['qualify_frequency', 'expiration_time'])
+ op.create_index('ps_aors_qualifyfreq_contact', 'ps_aors', ['qualify_frequency', 'contact'])
+def downgrade():
+ op.drop_index('ps_aors_qualifyfreq_contact')
+ op.drop_index('ps_contacts_qualifyfreq_exptime')
+ op.drop_column('ps_contacts', 'endpoint')
+ op.alter_column('ps_contacts', 'expiration_time', type_=sa.String(40))