<commit_before>(ns herder.systems.solver
  (:require
   [com.stuartsierra.component :as component]
   [reloaded.repl :refer [system]])
  (:import [java.util.concurrent Executors]))

(defrecord Solver []
  component/Lifecycle
  (start [component]
    (let [pool (Executors/newFixedThreadPool 1)
          tosolve (atom #{})
          solving (atom false)
          watch (atom nil)]
      (assoc component
             :pool pool
             :tosolve tosolve
             :solving solving
             :watch watch)))
  (stop [component]
    (if (-> component :pool nil? not)
      (.shutdownNow (:pool component)))
    (if (-> component :watch deref nil? not)
      (remove-watch (:tosolve component) (-> component :watch deref)))<commit_msg>Don't try and stop a watch that hasn't been started<commit_after>(ns herder.systems.solver
  (:require
   [com.stuartsierra.component :as component]
   [reloaded.repl :refer [system]])
  (:import [java.util.concurrent Executors]))

(defrecord Solver []
  component/Lifecycle
  (start [component]
    (let [pool (Executors/newFixedThreadPool 1)
          tosolve (atom #{})
          solving (atom false)
          watch (atom nil)]
      (assoc component
             :pool pool
             :tosolve tosolve
             :solving solving
             :watch watch)))
  (stop [component]
    (if (-> component :pool nil? not)
      (.shutdownNow (:pool component)))
    (if (and (-> component :watch nil? not) (-> component :watch deref nil? not))
      (remove-watch (:tosolve component) (-> component :watch deref)))
{'fraction_non_alphanumeric': 0.1268417680973735, 'fraction_numerical': 0.0012812299807815502, 'mean_word_length': 2.607390300230947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2743338', 'n_tokens_mistral': 471, 'n_tokens_neox': 464, 'n_words': 135}