Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
Fix timeout to just use millis
Browse files Browse the repository at this point in the history
  • Loading branch information
David Orme committed Nov 3, 2015
1 parent 2816bf8 commit de53b34
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/okku/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
[akka.remote RemoteScope]
[akka.pattern Patterns]
[scala.concurrent Await]
[scala.concurrent.duration Duration]
[java.util.concurrent TimeUnit]
[com.typesafe.config ConfigFactory])
(:require clojure.string))
Expand Down Expand Up @@ -71,17 +70,12 @@
([target msg] `(.tell ~target ~msg (.getSelf ~'this))))


(defn to-millis [duration]
(.convert TimeUnit/MILLISECONDS
(:value duration)
(:unit duration)))

(defn ask
"Use the Akka ask pattern. Returns a future object
which can be waited on by calling 'wait'"
[^ActorRef actor msg timeout]
(let [result (promise)]
(.map (Patterns/ask actor msg (to-millis timeout)))))
(.map (Patterns/ask actor msg timeout))))

(def ? ask)

Expand Down

0 comments on commit de53b34

Please sign in to comment.