   (reset! (:current-val lossy-worker) new-val)
   (.put (:queue lossy-worker) :job))
 
-
-(defn- log-event
-  "Log event on separate thread to ensure logging doesn't interfere with
-  event handling latency"
-  [msg & args]
-  (future (apply log/debug msg args)))
-
 (defn on-event
   "Asynchronously runs handler whenever events of event-type are
   fired. This asynchronous behaviour can be overridden if required -

  potentially long-running handler fns where handling the most recent
  event is all that matters."
  [event-type handler key]
  (let [worker (lossy-worker (fn [val]
                               (handler val)))]
    (on-sync-event event-type
                   (fn [msg]
                     (lossy-send worker msg))

(defonce ^:private event-debug* (atom false))
(defonce ^:private monitoring?* (atom false))
(defonce ^:private monitor* (atom {}))
(defonce ^:private lossy-workers* (atom {}))

(defn- log-event
  "Log event on separate thread to ensure logging doesn't interfere with
  event handling latency"
  [msg & args]
  (future (apply log/debug msg args)))

(defrecord LossyWorker [queue worker current-val])

