From 801e29feb1a9b616d01bfc482313d39529421aa9 Mon Sep 17 00:00:00 2001 From: mdumandag Date: Thu, 17 Dec 2020 17:26:04 +0300 Subject: [PATCH 1/2] Fix invocation retry mechanism If the invocation is meant to be sent to a certain connection and we receive TargetDisconnectedError(in case of the detection of a closed connection) or IOError(in case of actual IO error) for it, we should not retry. --- hazelcast/invocation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hazelcast/invocation.py b/hazelcast/invocation.py index 2709a28cad..295f8ad879 100644 --- a/hazelcast/invocation.py +++ b/hazelcast/invocation.py @@ -237,7 +237,7 @@ def _notify_error(self, invocation, error): def _should_retry(self, invocation, error): if invocation.connection and isinstance(error, (IOError, TargetDisconnectedError)): - return True + return False if invocation.uuid and isinstance(error, TargetNotMemberError): return False From 57ceb0cdb5ca1ec4f3755138bfaec76b2db9b653 Mon Sep 17 00:00:00 2001 From: mdumandag Date: Fri, 18 Dec 2020 10:20:23 +0300 Subject: [PATCH 2/2] fix test_listener_re_register --- tests/reconnect_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/reconnect_test.py b/tests/reconnect_test.py index 4a73157b0e..40667d9f6f 100644 --- a/tests/reconnect_test.py +++ b/tests/reconnect_test.py @@ -69,7 +69,7 @@ def test_listener_re_register(self): "cluster_connect_timeout": 5.0, }) - map = client.get_map("map") + map = client.get_map("map").blocking() collector = event_collector() reg_id = map.add_entry_listener(added_func=collector) @@ -83,7 +83,7 @@ def assert_events(): if client.lifecycle_service.is_running(): while True: try: - map.put("key-%d" % count.get_and_increment(), "value").result() + map.put("key-%d" % count.get_and_increment(), "value") break except TargetDisconnectedError: pass