avoid lost messages after activate message

messages might get lost after activate, when the number of parameters
exceeds maxlen of the output queue, as a limited deque silently overwrites
messages.

first try: use an infinite deque, but slow down appending thread when deque
gets too big
-> does not work because the appending thread is the same

second try: increase maximum a lot, on overflow log an error message and
close connection

Change-Id: I20376f7e08240dabe43269fa63c596f07e59ddf6
Reviewed-on: https://forge.frm2.tum.de/review/20982
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2019-08-05 17:15:12 +02:00
parent 1e6fa76717
commit cd1b4cf4e2
3 changed files with 19 additions and 8 deletions

View File

@ -32,8 +32,10 @@ def encode_msg_frame(action, specifier=None, data=None):
data may be an json-yfied python object"""
action = action.encode('utf-8')
if specifier is None:
# implicit: data is None
return b''.join((action, EOL))
if data is None:
return b''.join((action, EOL))
# error_activate might have no specifier
specifier = ''
specifier = specifier.encode('utf-8')
if data:
data = json.dumps(data).encode('utf-8')