Unverified Commit 8a3e2ed9 authored by Philipp Sommer's avatar Philipp Sommer
Browse files

rename connectionAttempts to connection_attempts

parent 1d8e5e91
Pipeline #45233 passed with stage
in 1 minute and 6 seconds
......@@ -57,7 +57,7 @@ class MessageConsumer(WebsocketConnection):
self.send_lock = threading.Lock()
self.max_payload_size = pulsar_config.max_payload_size
self.connectionAttempts = 0
self.connection_attempts = 0
self.reconnectTimeout = MessageConsumer.INITIAL_TIMEOUT_SLEEP
self.subscription = None
self.producers: Dict[str, websocket.WebSocket] = {}
......@@ -73,19 +73,19 @@ class MessageConsumer(WebsocketConnection):
# create consumer socket subscription
while (
not self.connectionAttempts
not self.connection_attempts
> MessageConsumer.MAX_CONNECTION_ATTEMPTS
):
try:
self.connectionAttempts += 1
print("connection attempt {}".format(self.connectionAttempts))
self.connection_attempts += 1
print("connection attempt {}".format(self.connection_attempts))
self.subscription = self.open_socket(
subscription=subscription_name
)
if self.subscription:
# successful connection - reset timeout and attempt count
self.connectionAttempts = 0
self.connection_attempts = 0
self.reconnectTimeout = (
MessageConsumer.INITIAL_TIMEOUT_SLEEP
)
......@@ -166,13 +166,13 @@ class MessageConsumer(WebsocketConnection):
self.disconnect()
def reconnect(self):
print("reconnect, attempt {0}".format(self.connectionAttempts))
print("reconnect, attempt {0}".format(self.connection_attempts))
# do we exceed the maximum number of connection attempts
if self.connectionAttempts > self.MAX_CONNECTION_ATTEMPTS:
if self.connection_attempts > self.MAX_CONNECTION_ATTEMPTS:
print(
"exceeding maximum connection attempts: {0}".format(
self.connectionAttempts
self.connection_attempts
)
)
self.loop.stop()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment