Add environment variable to control the size of the refresh queue.

This commit is contained in:
Alexander K. Hudek 2015-02-12 15:44:57 -05:00
parent 10db6d78d9
commit bbf1a4c794
2 changed files with 12 additions and 7 deletions

View file

@ -1,4 +1,4 @@
(defproject views "1.0.0"
(defproject views "1.1.0"
:description "A view to the past helps navigate the future."
:url "https://github.com/diligenceengine/views"
@ -8,15 +8,14 @@
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/tools.logging "0.2.6"]
[org.clojure/core.async "0.1.303.0-886421-alpha"]
[honeysql "0.4.3"]
[clj-logging-config "1.9.10"]
[zip-visit "1.0.2"]
[prismatic/plumbing "0.3.5"]
[pjstadig/humane-test-output "0.6.0"]]
[pjstadig/humane-test-output "0.6.0"]
[environ "1.0.0"]]
:profiles {:test {:dependencies [[org.clojure/tools.nrepl "0.2.3"]
[environ "0.4.0"]
[environ "1.0.0"]
[org.clojure/data.generators "0.1.2"]]
:injections [(require 'pjstadig.humane-test-output)

View file

@ -4,7 +4,8 @@
(:require
[views.protocols :refer [IView id data relevant?]]
[plumbing.core :refer [swap-pair!]]
[clojure.tools.logging :refer [debug error]]))
[clojure.tools.logging :refer [debug error]]
[environ.core :refer [env]]))
;; The view-system data structure has this shape:
;;
@ -20,7 +21,12 @@
;;
;; Each hint has the form {:namespace x :hint y}
(def refresh-queue (ArrayBlockingQueue. 500))
(def refresh-queue-size
(if-let [n (:views-refresh-queue-size env)]
(Long/parseLong n)
1000))
(def refresh-queue (ArrayBlockingQueue. refresh-queue-size))
(defn subscribe-view!
[view-system view-sig subscriber-key data-hash]