public boolean isChangeUpToDate()

in src/main/java/com/ericsson/gerrit/plugins/highavailability/index/ChangeCheckerImpl.java [96:121]


  public boolean isChangeUpToDate(Optional<IndexEvent> indexEventOption) throws IOException {
    getComputedChangeTs();
    log.atFine().log("Checking change %s against index event %s", this, indexEventOption);
    if (!computedChangeTs.isPresent()) {
      log.atWarning().log("Unable to compute last updated ts for change %s", changeId);
      return false;
    }
    try {
      if (indexEventOption.isPresent()) {
        try (Repository repo = gitRepoMgr.openRepository(changeNotes.get().getProjectName())) {
          IndexEvent indexEvent = indexEventOption.get();
          return (computedChangeTs.get() > indexEvent.eventCreatedOn)
              || (computedChangeTs.get() == indexEvent.eventCreatedOn)
                  && (Objects.isNull(indexEvent.targetSha)
                      || Objects.equals(getBranchTargetSha(), indexEvent.targetSha))
                  && (Objects.isNull(indexEvent.metaSha)
                      || Objects.equals(getMetaSha(repo), indexEvent.metaSha));
        }
      }
      return true;

    } catch (IOException ex) {
      log.atWarning().log("Unable to read meta sha for change %s", changeId);
      return false;
    }
  }