send regardless of whether remote is connected since it can be a Batch with ping/pongs
@@ -768,17 +768,20 @@ class ZStack(NetworkInterface):
try:
if not serialized:
msg = self.prepare_to_send(msg)
- if remote.isConnected or msg in self.healthMessages:
- self.metrics.add_event(self.mt_outgoing_size, len(msg))
+
logger.trace('{} transmitting message {} to {} by socket {} {}'
.format(self, msg, uid, socket.FD, socket.underlying))
socket.send(msg, flags=zmq.NOBLOCK)
+
+ if remote.isConnected or msg in self.healthMessages:
+ self.metrics.add_event(self.mt_outgoing_size, len(msg))
else:
logger.warning('Remote {} is not connected - message will not be sent immediately.'
'If this problem does not resolve itself - check your firewall settings'.format(uid))
self._stashed_to_disconnected \
.setdefault(uid, deque(maxlen=self.config.ZMQ_STASH_TO_NOT_CONNECTED_QUEUE_SIZE)) \
.append(msg)
+
return True, err_str
except zmq.Again:
logger.warning('{} could not transmit message to {}'.format(self, uid))
