From c77be6aea8ecf0c40479818b234de3acebdbb211 Mon Sep 17 00:00:00 2001 From: gered Date: Thu, 19 May 2016 17:37:09 -0400 Subject: [PATCH] remove set-hint-transport-fn!, instead use put-hints-fn in view-system --- src/views/honeysql/core.clj | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/views/honeysql/core.clj b/src/views/honeysql/core.clj index 08bfe98..190fc4a 100644 --- a/src/views/honeysql/core.clj +++ b/src/views/honeysql/core.clj @@ -1,12 +1,14 @@ (ns views.honeysql.core (:require - [views.core :refer [hint refresh-views!]] + [views.core :refer [view-system hint refresh-views!]] [views.honeysql.util :refer [query-tables]] [honeysql.core :as hsql] [clojure.tools.logging :refer [error]] [clojure.java.jdbc :as j])) -(def send-hints! (atom (fn [hints] (refresh-views! hints)))) +(defn send-hints! + [hints] + ((:put-hints-fn @view-system) hints)) (defmacro with-view-transaction "Like with-db-transaction, but sends view hints at end of transaction." @@ -18,7 +20,7 @@ result# (j/with-db-transaction [t# ~db ~@args] (let [~tvar (assoc ~db :hints hints#)] ~@forms))] - (@send-hints! @hints#) + (send-hints! @hints#) result#)))) (defn execute-honeysql! @@ -41,12 +43,5 @@ hsql-hint (hint :views/honeysql (query-tables action-map))] (if-let [hints (:hints db)] (swap! hints conj hsql-hint) - (@send-hints! [hsql-hint])) + (send-hints! [hsql-hint])) results)) - -(defn set-hint-transport-fn! - "The hint transport function should take a collection of hints and - send them to the configured view system. On a non-distribued server this - can be: (fn [hints] (refresh-views! views-config hints))" - [f] - (reset! send-hints! f)) \ No newline at end of file