Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'oom' into develop

  • Loading branch information...
commit b6ae6e078b3c3146c5ff5544ff4e4b03b80c645d 2 parents e9f7611 + dd0793e
@amalloy amalloy authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/foreclojure/core.clj
View
15 src/foreclojure/core.clj
@@ -3,6 +3,7 @@
[compojure.handler :as handler]
[foreclojure.config :as config]
[sandbar.stateful-session :as session])
+ (:import [java.lang OutOfMemoryError])
(:use [compojure.core :only [defroutes routes GET]]
[foreclojure.static :only [static-routes welcome-page]]
[foreclojure.api :only [api-routes]]
@@ -99,8 +100,18 @@
(defn run []
(prepare-mongo)
(register-heartbeat)
- (run-jetty (var app) {:join? *block-server*
- :port (get config :jetty-port default-jetty-port)})))
+ (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]
(binding [*block-server* true]
Please sign in to comment.
Something went wrong with that request. Please try again.