private void checkAndMaybeComplete() {
    // operationCompleted is true if Blob_Authorization_Failure was received.
    if (operationTracker.isDone() || operationCompleted) {

      if (operationTracker.hasSucceeded()) {
        operationException.set(null);
      } else {
        // the operation is failed, try to recover with ReplicateBlob
        if (shouldReplicateBlobAndRetry()) {
          // if retryWithReplicateBlob returns true, it's under retry. operation is not completed yet. so return.
          // if it returns false, continue the following code to set the proper operationException and complete the request.
          if (retryWithReplicateBlob()) {
            return;
          }
        }
        if (operationTracker.hasFailedOnNotFound()) {
          operationException.set(new RouterException("TtlUpdateOperation failed because of BlobNotFound",
              RouterErrorCode.BlobDoesNotExist));
        } else if (operationTracker.hasSomeUnavailability()) {
          setOperationException(new RouterException("TtlUpdateOperation failed possibly because of offline replicas",
              RouterErrorCode.AmbryUnavailable));
        }

        // check if we want to record the partially failed request and repair in the background.
        if (shouldRunOfflineRepair()) {
          RepairRequestRecord record = null;
          try {
            List<ReplicaId> successfulReplica = operationTracker.getSuccessReplica();
            DataNodeId sourceDataNode = successfulReplica.get(0).getDataNodeId();
            record =
                new RepairRequestRecord(blobId.getID(), blobId.getPartition().getId(), sourceDataNode.getHostname(),
                    sourceDataNode.getPort(), RepairRequestRecord.OperationType.TtlUpdateRequest, operationTimeMs,
                    LIFE_VERSION_FROM_FRONTEND, expiresAtMs);
            repairRequestsDb.putRepairRequests(record);

            // treat the ttlUpdate command as a success
            operationException.set(null);
            routerMetrics.offlineRepairOnTtlUpdateCount.inc();
            LOGGER.info("RepairRequest : inject repair request {} to the database {}", record, repairRequestsDb);
          } catch (Exception e) {
            routerMetrics.offlineRepairOnTtlUpdateErrorCount.inc();
            LOGGER.error("RepairRequest : failed to write the {} to the database {}", record, repairRequestsDb);
          }
        }
      }

      if (QuotaUtils.postProcessCharge(quotaChargeCallback)) {
        try {
          quotaChargeCallback.checkAndCharge(false, true);
        } catch (QuotaException quotaException) {
          LOGGER.info("Exception {} while charging quota for ttl update operation.", quotaException.toString());
        }
      }
      operationCompleted = true;
    }
  }
Completes the {@link TtlUpdateOperation} if it is done.
ambry-router/src/main/java/com/github/ambry/router/TtlUpdateOperation.java