-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INDY-2164: add re-sending failed msgs for clients #1260
INDY-2164: add re-sending failed msgs for clients #1260
Conversation
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
stp_zmq/zstack.py
Outdated
@@ -130,6 +130,7 @@ def __init__(self, name, ha, basedirpath, msgHandler, restricted=True, | |||
self._stashed_to_disconnected = {} | |||
self._stashed_pongs = set() | |||
self._received_pings = set() | |||
self._waiting_messages = dict() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It's better to use
{}
to init a new dict. - How do we limit the number of items in
_waiting_messages
to avoid OOM?
stp_zmq/zstack.py
Outdated
@@ -802,6 +804,26 @@ def transmit(self, msg, uid, timeout=None, serialized=False): | |||
return False, err_str | |||
|
|||
def transmitThroughListener(self, msg, ident) -> Tuple[bool, Optional[str]]: | |||
self._waiting_messages.setdefault(ident, []) | |||
self._waiting_messages[ident].append(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can write self._waiting_messages.setdefault(ident, []).append(msg)
stp_zmq/zstack.py
Outdated
result, error_msg, need_to_resend = self._transmit_one_msg_through_listener(current_msg, | ||
ident) | ||
if not need_to_resend: | ||
self._waiting_messages[ident].remove(current_msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to remove ident
from _waiting_messages
if there are no more messages there?
stp_zmq/zstack.py
Outdated
for current_msg in list(self._waiting_messages[ident]): | ||
result, error_msg, need_to_resend = self._transmit_one_msg_through_listener(current_msg, | ||
ident) | ||
if not need_to_resend: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to clear all messages for a given ident
after timeout?
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
plenum/test/zstack_tests/test_send_client_msgs_with_delay_reqs.py
Outdated
Show resolved
Hide resolved
…nto bug-2164-zmq-sending-fix
Signed-off-by: toktar <renata.toktar@dsr-corporation.com>
Signed-off-by: toktar renata.toktar@dsr-corporation.com