bruno-roustant commented on code in PR #115: URL: https://github.com/apache/solr-sandbox/pull/115#discussion_r1948118413
########## encryption/src/main/java/org/apache/solr/encryption/EncryptionRequestHandler.java: ########## @@ -527,31 +512,33 @@ private void commitEncryptionStart(String keyId, req.getCore().getUpdateHandler().commit(commitCmd); } - private void encryptAsync(SolrQueryRequest req, long startTimeNs) { + private void encryptAsync(SolrQueryRequest req) { log.debug("Submitting async encryption"); executor.submit(() -> { try { EncryptionUpdateLog updateLog = getEncryptionUpdateLog(req.getCore()); if (updateLog != null) { log.debug("Encrypting update log"); + long startTimeNs = getTimeSource().getTimeNs(); boolean logEncryptionComplete = updateLog.encryptLogs(); - log.info("{} encrypted the update log in {}", - logEncryptionComplete ? "Successfully" : "Partially", elapsedTime(startTimeNs)); + log.info("{} encrypted the update log in {} ms", + logEncryptionComplete ? "Successfully" : "Partially", elapsedTimeMs(startTimeNs)); // If the logs encryption is not complete, it means some logs are currently in use. // The encryption will be automatically be retried after the next commit which should // release the old transaction log and make it ready for encryption. } log.debug("Triggering index encryption"); + long startTimeNs = getTimeSource().getTimeNs(); CommitUpdateCommand commitCmd = new CommitUpdateCommand(req, true); // Trigger EncryptionMergePolicy.findForcedMerges() to re-encrypt // each segment which is not encrypted with the latest active key id. commitCmd.maxOptimizeSegments = Integer.MAX_VALUE; req.getCore().getUpdateHandler().commit(commitCmd); - log.info("Successfully triggered index encryption with commit in {}", elapsedTime(startTimeNs)); + log.info("Successfully triggered index encryption with commit in {} ms", elapsedTimeMs(startTimeNs)); Review Comment: I want to keep TimeSource to be able to inject a mock time source in tests. So I'll separate the computation of the elapsed time in ns, and the conversion to ms in another method for clarity. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org