      :log (conj log message)
      :peer-choices (conj peer-choices next-peer)}))
 
-(defn peer-gen [replica-state-gen]
+(defn peer-gen 
+  "Generator to look into all of the peer's write queues
+  and pick an entry to get fake written next"
+  [replica-state-gen]
   (gen/bind replica-state-gen 
             (fn [state]
               ; we only play back log messages from peers who have

  (checking
    "Checking joins"
    10000
    [{:keys [replica peer-choices]} 
     (apply-entries-gen 
       (gen/return
         {:replica {:job-scheduler (:onyx.peer/job-scheduler peer-config)
                    :messaging (:onyx.messaging/config peer-config)}
          :message-id 0
          :entries {:a [{:fn :prepare-join-cluster 
                         :immediate? true
                         :args {:peer-site (extensions/peer-site messaging)

(def messaging 
  (component/start (aeron/aeron {:opts peer-config})))

(defn bump-forward-immediates 
  "If peer hasn't finished joining yet, bump all their 
  log entries to the head of their queue. Order is otherwise stable."
  [entries peers peer-id]
  (if ((set peers) peer-id)
    entries
    (vec (concat (filter :immediate? entries)
                 (remove :immediate? entries)))))

(defn active-peers [replica entry]
  (cond-> (set (concat (:peers replica)
                       ; might not need these with the below entries
                       (vals (or (:prepared replica) {})) 
                       (vals (or (:accepted replica) {}))))
    (:id (:args entry)) (conj (:id (:args entry)))
    (:joiner (:args entry)) (conj (:joiner (:args entry)))))

(defn apply-entry [replica entries entry]
  (let [new-replica (extensions/apply-log-entry entry replica)
        diff (extensions/replica-diff entry replica new-replica)
        peers (active-peers replica entry)
        peer-reactions (keep (fn [peer-id] 
                               (if-let [reactions (extensions/reactions entry 
                                                                        replica 
