void removeOldEvents()

in src/main/java/com/ericsson/gerrit/plugins/eventslog/sql/SQLClient.java [138:152]


  void removeOldEvents(int maxAge) {
    try {
      execute(
          format(
              "DELETE FROM %s WHERE %s < '%s'",
              TABLE_NAME,
              DATE_ENTRY,
              new Timestamp(System.currentTimeMillis() - MILLISECONDS.convert(maxAge, DAYS))));
      log.atInfo().log(
          "Events older than %d days were removed from database %s", maxAge, ds.getPoolName());
    } catch (SQLException e) {
      log.atWarning().withCause(e).log(
          "Cannot remove old event entries from database %s", ds.getPoolName());
    }
  }