<commit_before>package com.hubspot.baragon.service.worker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.hubspot.baragon.data.BaragonStateDatastore;

@Singleton
public class BaragonBackgroundStateUpdatingWorker implements Runnable {
  private static final Logger LOG = LoggerFactory.getLogger(BaragonBackgroundStateUpdatingWorker.class);

  private final BaragonStateDatastore stateDatastore;
  private Optional<Integer> lastUpdateId;

  @Inject
  public BaragonBackgroundStateUpdatingWorker(BaragonStateDatastore stateDatastore) {
    this.stateDatastore = stateDatastore;
    this.lastUpdateId = Optional.absent();
  }

  @Override
  public void run() {
    try {
      LOG.info("Updating state node in ZK...");

      final long start = System.currentTimeMillis();

      final Optional<Integer> currentUpdateId = stateDatastore.getStateVersion();

      if (!currentUpdateId.equals(lastUpdateId)) {
        stateDatastore.updateStateNode();
        LOG.info("Updated state node in ZK in {}ms (version: {} -> {})", System.currentTimeMillis() - start, lastUpdateId, currentUpdateId);
        lastUpdateId = currentUpdateId;
      } else {
        LOG.info("State node unchanged in {}ms (version: {})", System.currentTimeMillis() - start, lastUpdateId);
      }
    } catch (Exception e) {
      LOG.error("Caught exception during state node update", e);
    }
  }
}
<commit_msg>tweak logging levels for background state node update<commit_after>package com.hubspot.baragon.service.worker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.hubspot.baragon.data.BaragonStateDatastore;

@Singleton
public class BaragonBackgroundStateUpdatingWorker implements Runnable {
  private static final Logger LOG = LoggerFactory.getLogger(BaragonBackgroundStateUpdatingWorker.class);

  private final BaragonStateDatastore stateDatastore;
  private Optional<Integer> lastUpdateId;

  @Inject
  public BaragonBackgroundStateUpdatingWorker(BaragonStateDatastore stateDatastore) {
    this.stateDatastore = stateDatastore;
    this.lastUpdateId = Optional.absent();
  }

  @Override
  public void run() {
    try {
      LOG.trace("Updating state node in ZK...");

      final long start = System.currentTimeMillis();

      final Optional<Integer> currentUpdateId = stateDatastore.getStateVersion();

      if (!currentUpdateId.equals(lastUpdateId)) {
        stateDatastore.updateStateNode();
        LOG.debug("Updated state node in ZK in {}ms (version: {} -> {})", System.currentTimeMillis() - start, lastUpdateId, currentUpdateId);
        lastUpdateId = currentUpdateId;
      } else {
        LOG.trace("State node unchanged in {}ms (version: {})", System.currentTimeMillis() - start, lastUpdateId);
      }
    } catch (Exception e) {
      LOG.error("Caught exception during state node update", e);
    }
  }
}

{'fraction_non_alphanumeric': 0.10231345715216683, 'fraction_numerical': 0.0013033561420658195, 'mean_word_length': 4.293103448275862, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4338339', 'n_tokens_mistral': 891, 'n_tokens_neox': 888, 'n_words': 199}