def _send_options_message(self): if self.cql_version is None and (not self.compression or not locally_supported_compressions): log.debug( "Not sending options message for new connection(%s) to %s " "because compression is disabled and a cql version was not " "specified", id(self), self.host) self._compressor = None self.cql_version = DEFAULT_CQL_VERSION self._send_startup_message() else: log.debug( "Sending initial options message for new connection (%s) to %s", id(self), self.host) self.send_msg(OptionsMessage(), self.get_request_id(), self._handle_options_response)
def __init__(self, connection, owner): self._exception = None self._event = Event() self.connection = connection self.owner = owner log.debug( "Sending options message heartbeat on idle connection (%s) %s", id(connection), connection.host) with connection.lock: if connection.in_flight <= connection.max_request_id: connection.in_flight += 1 connection.send_msg(OptionsMessage(), connection.get_request_id(), self._options_callback) else: self._exception = Exception( "Failed to send heartbeat because connection 'in_flight' exceeds threshold" ) self._event.set()