Skip to content
This repository
Browse code

Merge branch 'oom' into develop

  • Loading branch information...
commit b6ae6e078b3c3146c5ff5544ff4e4b03b80c645d 2 parents e9f7611 + dd0793e
Alan Malloy amalloy authored

Showing 1 changed file with 13 additions and 2 deletions. Show diff stats Hide diff stats

  1. +13 2 src/foreclojure/core.clj
15 src/foreclojure/core.clj
@@ -3,6 +3,7 @@
3 3 [compojure.handler :as handler]
4 4 [foreclojure.config :as config]
5 5 [sandbar.stateful-session :as session])
  6 + (:import [java.lang OutOfMemoryError])
6 7 (:use [compojure.core :only [defroutes routes GET]]
7 8 [foreclojure.static :only [static-routes welcome-page]]
8 9 [foreclojure.api :only [api-routes]]
@@ -99,8 +100,18 @@
99 100 (defn run []
100 101 (prepare-mongo)
101 102 (register-heartbeat)
102   - (run-jetty (var app) {:join? *block-server*
103   - :port (get config :jetty-port default-jetty-port)})))
  103 + (letfn [(run []
  104 + (run-jetty (var app) {:join? *block-server*
  105 + :port (get config :jetty-port
  106 + default-jetty-port)}))]
  107 + (if *block-server*
  108 + (while true
  109 + (try
  110 + (run)
  111 + (catch OutOfMemoryError _
  112 + (binding [*out* *err*]
  113 + (println "Caught error at " (java.util.Date.))))))
  114 + (run)))))
104 115
105 116 (defn -main [& args]
106 117 (binding [*block-server* true]

0 comments on commit b6ae6e0

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