summaryrefslogtreecommitdiff
path: root/lib/extras.py
diff options
context:
space:
mode:
authorOleksandr Shulgin <oleksandr.shulgin@zalando.de>2015-10-19 15:42:42 +0200
committerOleksandr Shulgin <oleksandr.shulgin@zalando.de>2015-10-19 15:42:42 +0200
commit4ab7cf0157ae311aa22c0cb38410a3d2ab9bea06 (patch)
treeacd5c8837397611b0ed515c69c2498395ebd5aa1 /lib/extras.py
parent0435320f34c56ced8c15899053920fc94fd4f3d7 (diff)
downloadpsycopg2-4ab7cf0157ae311aa22c0cb38410a3d2ab9bea06.tar.gz
Replace stop_replication with requirement for an exception.
Diffstat (limited to 'lib/extras.py')
-rw-r--r--lib/extras.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/extras.py b/lib/extras.py
index dc2d5e6..8854ec2 100644
--- a/lib/extras.py
+++ b/lib/extras.py
@@ -500,6 +500,18 @@ class PhysicalReplicationConnection(ReplicationConnectionBase):
super(PhysicalReplicationConnection, self).__init__(*args, **kwargs)
+class StopReplication(Exception):
+ """
+ Exception used to break out of the endless loop in
+ `~ReplicationCursor.consume_replication_stream()`.
+
+ Subclass of `~exceptions.Exception`. Intentionally *not* inherited from
+ `~psycopg2.Error` as occurrence of this exception does not indicate an
+ error.
+ """
+ pass
+
+
class ReplicationCursor(_cursor):
"""A cursor used for communication on the replication protocol."""