Permalink
Browse files

Remove namespaces after 10 minutes.

  • Loading branch information...
1 parent 8a3abf7 commit c33d18e37f4c9541e32cca0cc864f9c1906b5ef7 @Raynes committed Nov 1, 2011
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/tryclojure/core.clj
@@ -119,7 +119,9 @@
(let [count (inc (:counter old))]
(assoc old
:counter count
- count (sandbox try-clojure-tester :timeout 2000))))
+ count (sandbox try-clojure-tester
+ :timeout 2000
+ :namespace (symbol (str "sandbox" (rand-int Integer/MAX_VALUE)))))))
(defn eval-request [expr]
(try
@@ -128,12 +130,13 @@
(do
(if-let [sb (@sandboxes (session/get :sb))]
sb
- (let [sbs (swap! sandboxes add-user)
- count (:counter sbs)]
+ (let [{count :counter} (swap! sandboxes add-user)]
(session/put! :sb count)
- (future (Thread/sleep 900000)
- (swap! sandboxes dissoc count))
- (sbs count)))))
+ (future
+ (Thread/sleep 600000)
+ (-> ((get @sandboxes count) '*ns*) str symbol remove-ns)
+ (swap! sandboxes dissoc count))
+ (get @sandboxes count)))))
(catch TimeoutException _
{:error true :message "Execution Timed Out!"})
(catch Exception e

0 comments on commit c33d18e

Please sign in to comment.