<commit_before>;; Copyright © 2016, JUXT LTD.

(ns edge.server
  (:require
   [aleph.http :as http]
   [bidi.vhosts :refer [make-handler vhosts-model]]
   [clojure.java.io :as io]
   [clojure.tools.logging :refer :all]
   [com.stuartsierra.component :refer [Lifecycle using]]
   [schema.core :as s]
   [yada.yada :refer [yada resource] :as yada])
  (:import
   [bidi.vhosts VHostsModel]))

(s/defrecord HttpServer [port :- s/Int
                         routes
                         server]
  Lifecycle
  (start [component]
    (assoc component :server (yada/server routes {:port port})))
  (stop [component]
    (when-let [server (:server component)]
      (.close server))
    component))

(defn new-http-server [options]
  (map->HttpServer options))
<commit_msg>Use yada's new stop method<commit_after>;; Copyright © 2016, JUXT LTD.

(ns edge.server
  (:require
   [aleph.http :as http]
   [bidi.vhosts :refer [make-handler vhosts-model]]
   [clojure.java.io :as io]
   [clojure.tools.logging :refer :all]
   [com.stuartsierra.component :refer [Lifecycle using]]
   [schema.core :as s]
   [yada.yada :refer [yada resource] :as yada])
  (:import
   [bidi.vhosts VHostsModel]))

(s/defrecord HttpServer [port :- s/Int
                         routes
                         server]
  Lifecycle
  (start [component]
    (assoc component :server (yada/server routes {:port port})))
  (stop [component]
    (when-let [close (get-in component [:server :close])]
      (close))
    component))

(defn new-http-server [options]
  (map->HttpServer options))

{'fraction_non_alphanumeric': 0.14010282776349614, 'fraction_numerical': 0.005141388174807198, 'mean_word_length': 2.834975369458128, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6136939', 'n_tokens_mistral': 561, 'n_tokens_neox': 537, 'n_words': 141}