Process a new repair log response
179515
@Override
    public void deliver(VoltMessage message)
    {
        if (message instanceof Iv2RepairLogResponseMessage) {
            Iv2RepairLogResponseMessage response = (Iv2RepairLogResponseMessage)message;
            if (response.getRequestId() != m_requestId) {
                if (repairLogger.isTraceEnabled()) {
                    repairLogger.trace(m_whoami + "rejecting stale repair response."
                            + " Current request id is: " + m_requestId
                            + " Received response for request id: " + response.getRequestId());
                }
                return;
            }

            // Step 1: if the msg has a known (not MAX VALUE) handle, update m_maxSeen.
            if (response.getTxnId() != Long.MAX_VALUE) {
                m_maxSeenTxnId = Math.max(m_maxSeenTxnId, response.getTxnId());
            }

            // Step 2: track hashinator versions

            if (response.hasHashinatorConfig()) {
                Pair<Long,byte[]> proposed = response.getHashinatorVersionedConfig();
                if (proposed.getFirst() > m_newestHashinatorConfig.getFirst()) {
                    m_newestHashinatorConfig = proposed;
                }
            }

            // Step 3: offer to the union
            addToRepairLog(response);
            if (repairLogger.isDebugEnabled()) {
                repairLogger.debug(m_whoami + " collected from " + CoreUtils.hsIdToString(response.m_sourceHSId) +
                        ", message: " + response.getPayload());
            }

            // Step 4: update the corresponding replica repair struct.
            ReplicaRepairStruct rrs = m_replicaRepairStructs.get(response.m_sourceHSId);
            if (rrs.m_expectedResponses < 0) {
                if (repairLogger.isDebugEnabled()) {
                    repairLogger.debug(m_whoami + "collecting " + response.getOfTotal()
                    + " repair log entries from "
                    + CoreUtils.hsIdToString(response.m_sourceHSId));
                }
            }

            if (rrs.update(response)) {
                if (repairLogger.isDebugEnabled()) {
                    repairLogger.debug(m_whoami + "collected " + rrs.m_receivedResponses
                            + " responses for " + rrs.m_expectedResponses
                            + " repair log entries from " + CoreUtils.hsIdToString(response.m_sourceHSId));
                }

                if (areRepairLogsComplete()) {

                    TheHashinator.updateHashinator(ElasticHashinator.class,
                            m_newestHashinatorConfig.getFirst(), m_newestHashinatorConfig.getSecond(), true);

                    //no real transaction repair when triggered with MigratePartitionLeader. Theoretically it should not be here.
                    //MigratePartitionLeader should not trigger MP promotion.
                    if (m_isMigratePartitionLeader) {
                        m_promotionResult.set(new RepairResult(m_maxSeenTxnId));
                    } else {
                        repairSurvivors();
                    }
                }
            }
        }
    }
255993
def process_log_record(self, log_record):
        """"""
        log_record["version"] = __version__
        log_record["program"] = PROGRAM_NAME
        log_record["service_name"] = log_record.pop('threadName', None)
        # return jsonlogger.JsonFormatter.process_log_record(self, log_record)

        return log_record
991503
function dispatch(obj,payload) {
	if (obj.nitro) {
		processResponse(obj,payload);
	}
	else if (obj.fault) {
		nitro.logFault(obj);
	}
	else if (obj.errors) {
		nitro.logError(obj);
	}
	else {
		console.log(obj);
	}
	return {};
}
1189808
def _respond(self, resp):
        """"""
        response_queue = self._response_queues.get(timeout=0.1)
        response_queue.put(resp)
        self._completed_response_lines = []
        self._is_multiline = None
1141619
function logResponse(err, res) {
    if (err || (res && !res.ok)) {
      if (err) {
        log.warn('%s on response -> read plaintext body due an error (%s)', app.name, err.message);
      } else {
        log.warn('%s on response -> read plaintext body due an error (%s)', app.name, res.error);
      }
    } else if (res && !_.isEmpty(res.body)) {
      if  (res.body[my.config.encryptedBodyName]) {
        log.info('%s on response -> read encrypted body', app.name);
      } else {
        log.info('%s on response -> read plaintext body', app.name);
      }
    }
  }
756246
def after_log(logger, log_level, sec_format="%0.3f"):
    """"""
    log_tpl = ("Finished call to '%s' after " + str(sec_format) + "(s), "
               "this was the %s time calling it.")

    def log_it(retry_state):
        logger.log(log_level, log_tpl,
                   _utils.get_callback_name(retry_state.fn),
                   retry_state.seconds_since_start,
                   _utils.to_ordinal(retry_state.attempt_number))

    return log_it
888409
def process_response(self, response: requests.models.Response) -> dict:
        
        try:
            output = response.json()
        except json.JSONDecodeError: # Server is having a bad day and crashed.
            raise self.BadResponseError(
                'Json not returned with status code [' + str(response.status_code) + ']')

        if response.status_code == 400:
            return output

        if response.status_code not in [200, 201]: # Safety catch.
            raise self.BadResponseError(
                str(output) + ': with status code [' + str(response.status_code) +
                '] and params:' + str(output))

        return output['data']
138085
function loggingMiddleware(req, res, next) {
  logRequest(req, res);
  setupResponseInterceptors(req, res);
  next();
}
459427
def log_print_response(status_code, response, headers=None):
    

    log_msg = '\n<<<<<<<<<<<<<<<<<<<<<< Response <<<<<<<<<<<<<<<<<<\n'
    log_msg += '\t< Response code: {}\n'.format(str(status_code))
    if headers is not None:
        log_msg += '\t< Headers:\n{}\n'.format(json.dumps(dict(headers), sort_keys=True, indent=4))
    try:
        log_msg += '\t< Payload received:\n{}'.format(_get_pretty_body(headers, response))
    except:
        log_msg += '\t< Payload received:\n{}'.format(response)
    logger.debug(log_msg)
1263291
void addToRepairLog(Iv2RepairLogResponseMessage msg)
    {
        // don't add the null payload from the first message ack to the repair log
        if (msg.getPayload() == null) {
            return;
        }
        // MP repair log has at most two messages, complete message for prior transaction
        // and fragment message for current transaction, don't add message before prior completion
        if (msg.getTxnId() <= m_maxSeenCompleteTxnId) {
            return;
        }
        Iv2RepairLogResponseMessage prev = m_repairLogUnion.floor(msg);
        if (prev != null && (prev.getTxnId() != msg.getTxnId())) {
            prev = null;
        }

        if (msg.getPayload() instanceof CompleteTransactionMessage) {
            // prefer complete messages to fragment tasks. Completion message also erases prior staled messages
            m_repairLogUnion.removeIf((p) -> p.getTxnId() <= msg.getTxnId());
            m_repairLogUnion.add(msg);
            m_maxSeenCompleteTxnId = msg.getTxnId();
        }
        else if (prev == null) {
           m_repairLogUnion.add(msg);
        }
    }
408229
def inject_compile_log(response)
      if response['value'] && response['value'].is_a?(Hash) &&
        response['value']['result'].is_a?(Hash) &&
        blob_id = response['value']['result']['compile_log_id']
        compile_log = download_and_delete_blob(blob_id)
        response['value']['result']['compile_log'] = compile_log
      end
    end
668297
private void tryReloadingEditLog() throws IOException {
    LOG.info("Trying to reload the edit log ...");
    // The roll image count is 1 after edits.new was renamed to edits
    if (rollImageCount.get() == 1) {
      try {
        LOG.info("Trying to reload the edit log from " +
            editsFile.getAbsolutePath());
        openInputStream(editsFile);
        LOG.info("Successfully reloaded the edit log from " +
            editsFile.getAbsolutePath() + ". Trying to refresh position.");
        refreshStreamPosition();
        LOG.info("Successfully refreshed stream position");
        return;
      } catch (IOException e) {
        LOG.warn("Failed to reload from " + editsFile.getAbsolutePath(), e);
      }
    }
    
    try {
      LOG.info("Trying to reload the edit log from " +
          editsNewFile.getAbsolutePath());
      openInputStream(editsNewFile);
      LOG.info("Successfully reloaded the edit log from " +
          editsNewFile.getAbsolutePath() + ". Trying to refresh position.");
      refreshStreamPosition();
      LOG.info("Successfully refreshed stream position");
      return;
    } catch (IOException e) {
      LOG.error("Failed to reload from " + editsFile.getAbsolutePath(), e);
      throw e;
    }
  }
1144322
def process_response(self, request, response):
        
        if getattr(settings, 'FORCE_VARY_ON_HOST', True):
            patch_vary_headers(response, ('Host',))

        return response
385728
function handleProduceResponse(cb, err, res) {
    num_responses += 1;
    if (err) {
        console.log("Error producing message: " + err);
    } else {
        num_messages_acked += 1;
    }

    // We can only indicate were done if stdin was closed and we have no outstanding messages.
    checkSendingComplete(cb);
}
478990
async def _response_handler(self):
        """"""
        if self.debug is True:
            if self.debug is True:
                print("listenning response!")
        while True:
            try:
                res = await self.reader.readuntil(self.SEPARATOR)
            except:
                raise
            else:
                response = self.decoder(res)
                self._status_code_check(response)
725861
def _handle_response(self, response):
        
        if not str(response.status_code).startswith('2'):
            raise build_api_error(response)
        return response
171354
def repair_mongo(name, dbpath):
    """"""
    log_file = os.path.join(dbpath, 'mongod.log')
    cmd = [name, "--dbpath", dbpath, "--logpath", log_file, "--logappend",
           "--repair"]
    proc = subprocess.Popen(
        cmd, universal_newlines=True,
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    timeout = 45
    t_start = time.time()
    while time.time() - t_start < timeout:
        line = str(proc.stdout.readline())
        logger.info("repair output: %s" % (line,))
        return_code = proc.poll()
        if return_code is not None:
            if return_code:
                raise Exception("mongod --repair failed with exit code %s, "
                                "check log file: %s" % (return_code, log_file))
            # Success when poll() returns 0
            return
        time.sleep(1)
    proc.terminate()
    raise Exception("mongod --repair failed to exit after %s seconds, "
                    "check log file: %s" % (timeout, log_file))