Skip to content
Browse files

More attempts at ridding this caching issue

  • Loading branch information...
1 parent 15a9778 commit 5a8c0dd3dc384a38cf8bafb6ef2e2cf81551c0e8 @zolrath committed Sep 15, 2011
Showing with 18 additions and 19 deletions.
  1. +2 −19 src/andrew_site/views/content.clj
  2. +16 −0 src/andrew_site/views/welcome.clj
View
21 src/andrew_site/views/content.clj
@@ -5,8 +5,8 @@
somnium.congomongo
[somnium.congomongo.config :only [*mongo-config*]]))
-(mongo! :db "app1002329" :host "staff.mongohq.com" :port 10001)
-(authenticate "heroku" "4df8f6a5a6484618f44d7359d0d9f2bf")
+;(mongo! :db "app1002329" :host "staff.mongohq.com" :port 10001)
+;(authenticate "heroku" "4df8f6a5a6484618f44d7359d0d9f2bf")
(def major-skills
(map #(:skill %) (fetch :skills :where {:level "major"})))
@@ -26,23 +26,6 @@
(def jobs
(fetch :jobs))
-(defn split-mongo-url [url]
- "Parses mongodb url from heroku, eg. mongodb://user:pass@localhost:1234/db"
- (let [matcher (re-matcher #"^.*://(.*?):(.*?)@(.*?):(\d+)/(.*)$" url)] ;; Setup the regex.
- (when (.find matcher) ;; Check if it matches.
- (zipmap [:match :user :pass :host :port :db] (re-groups matcher))))) ;; Construct an options map.
-
-(defn maybe-init []
- "Checks if connection and collection exist, otherwise initialize."
- (when (not (connection? *mongo-config*)) ;; If global connection doesn't exist yet.
- (let [mongo-url (get (System/getenv) "MONGOHQ_URL") ;; Heroku puts it here.
- config (split-mongo-url mongo-url)] ;; Extract options.
- (println "Initializing mongo @ " mongo-url)
- (mongo! :db (:db config) :host (:host config) :port (Integer. (:port config))) ;; Setup global mongo.
- (authenticate (:user config) (:pass config)) ;; Setup u/p.
- (or (collection-exists? :firstcollection) ;; Create collection named 'firstcollection' if it doesn't exist.
- (create-collection! :firstcollection)))))
-
(def top-right
(list "Interested? " (mail-to "jobs@andrewmarrone.com?subject=Employment%20Opportunity" "Contact me!")))
View
16 src/andrew_site/views/welcome.clj
@@ -6,6 +6,22 @@
hiccup.core
hiccup.page-helpers))
+(defn split-mongo-url [url]
+ "Parses mongodb url from heroku, eg. mongodb://user:pass@localhost:1234/db"
+ (let [matcher (re-matcher #"^.*://(.*?):(.*?)@(.*?):(\d+)/(.*)$" url)] ;; Setup the regex.
+ (when (.find matcher) ;; Check if it matches.
+ (zipmap [:match :user :pass :host :port :db] (re-groups matcher))))) ;; Construct an options map.
+
+(defn maybe-init []
+ "Checks if connection and collection exist, otherwise initialize."
+ (when (not (connection? *mongo-config*)) ;; If global connection doesn't exist yet.
+ (let [mongo-url (get (System/getenv) "MONGOHQ_URL") ;; Heroku puts it here.
+ config (split-mongo-url mongo-url)] ;; Extract options.
+ (println "Initializing mongo @ " mongo-url)
+ (mongo! :db (:db config) :host (:host config) :port (Integer. (:port config))) ;; Setup global mongo.
+ (authenticate (:user config) (:pass config)) ;; Setup u/p.)))
+
(defpage "/" []
+ (maybe-init)
(let [jobs content/jobs]
(common/layout (common/jobs-list jobs) (common/sidebar))))

0 comments on commit 5a8c0dd

Please sign in to comment.
Something went wrong with that request. Please try again.