diff --git a/src/rss_thread_watch/config.clj b/src/rss_thread_watch/config.clj index 0626b83..0f2c959 100644 --- a/src/rss_thread_watch/config.clj +++ b/src/rss_thread_watch/config.clj @@ -78,6 +78,8 @@ boards)))) (defn config-fill-board-defaults + ;; TODO: must have check that if board is default, it's enabled, if it's not, give some big fat warning + ;; that users must always specify board, maybe change the error? "Fills every enabled board with default config values" [config] (let [defaults (:boards-defaults config)] diff --git a/src/rss_thread_watch/core.clj b/src/rss_thread_watch/core.clj index 4fab9df..c59a33e 100644 --- a/src/rss_thread_watch/core.clj +++ b/src/rss_thread_watch/core.clj @@ -72,6 +72,7 @@ (let [config (conf/get-some-config (:config options))] ;; TODO: probably refactor to use separate config.clj file when validation will be added ;; Init the few globals we have + ;; TODO: this all needs to go in separate function so it doesnt have to duplicated in repl-main (reset! conf/GLOBAL-CONFIG config) (reset! feed/boards-enabled-cache (set (keys (get config :boards-enabled)))) (reset! watcher/chod-threads-cache (watcher/generate-chod-cache-structure config)) @@ -83,6 +84,12 @@ (defn repl-main "Development entry point" [] + (let [config (conf/get-some-config nil)] + ;; TODO: probably refactor to use separate config.clj file when validation will be added + ;; Init the few globals we have + (reset! conf/GLOBAL-CONFIG config) + (reset! feed/boards-enabled-cache (set (keys (get config :boards-enabled)))) + (reset! watcher/chod-threads-cache (watcher/generate-chod-cache-structure config))) (jetty/run-jetty (rp/wrap-params #'feed/http-handler) {:port (:port conf/CONFIG-DEFAULT) ;; Dont block REPL thread diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index f5689c4..3ed7414 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -35,8 +35,8 @@ This is done by always making new GUID - (concat thread-number UNIX-time-of-data-update)" [thread time] (assoc thread :guid (str (:no thread) - "-" - time))) + "-" + time))) (defn new-guid-paranoid "Generate unique GUID on EVERY request to the feed. @@ -79,7 +79,7 @@ "true" (fn [x] (new-guid-always x time-of-generation)) update-only-guid) cache-start-index (first (ut/indices (fn [x] (>= (:chod x) chod-treshold)) - cache)) + cache)) ;; So we don't have to search thru everything we have cached needed-cache-part (subvec cache cache-start-index) ;; Here we gonna run fmap but not really diff --git a/src/rss_thread_watch/utils.clj b/src/rss_thread_watch/utils.clj index afab99f..5d81d9b 100644 --- a/src/rss_thread_watch/utils.clj +++ b/src/rss_thread_watch/utils.clj @@ -74,6 +74,7 @@ {k (map-apply-defaults conf-val default-val)} {k (nil?-else conf-val default-val)}))))) +;; This is a shitty version of reduce-kv (defn fmap "Applies function [f] to every key and value in map [m] Function signature should be (f [key value]).