Permalink
Browse files

Fix up OOM-catch patch

  • Loading branch information...
1 parent f967795 commit dd0793e4549475c52f8562bc0a9af2e84dc809e5 @amalloy amalloy committed Dec 31, 2011
Showing with 13 additions and 8 deletions.
  1. +13 −8 src/foreclojure/core.clj
View
@@ -98,14 +98,19 @@
(let [default-jetty-port 8080]
(defn run []
- (try
- (do
- (prepare-mongo)
- (register-heartbeat)
- (run-jetty (var app) {:join? *block-server*
- :port (get config :jetty-port default-jetty-port)}))
- (catch OutOfMemoryError e
- ;;TODO: log this?
+ (prepare-mongo)
+ (register-heartbeat)
+ (letfn [(run []
+ (run-jetty (var app) {:join? *block-server*
+ :port (get config :jetty-port
+ default-jetty-port)}))]
+ (if *block-server*
+ (while true
+ (try
+ (run)
+ (catch OutOfMemoryError _
+ (binding [*out* *err*]
+ (println "Caught error at " (java.util.Date.))))))
(run)))))
(defn -main [& args]

0 comments on commit dd0793e

Please sign in to comment.