Print timing info for pelias requests.
This commit is contained in:
parent
a45360d806
commit
8b0b1abdb3
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
(def base-pelias-url "http://lockheed.local:4000/v1")
|
(def base-pelias-url "http://lockheed.local:4000/v1")
|
||||||
|
|
||||||
|
(defn now []
|
||||||
|
(.getTime (js/Date.)))
|
||||||
|
|
||||||
|
|
||||||
;; Does an HTTP GET to a pelias API url. Returns a promise that
|
;; Does an HTTP GET to a pelias API url. Returns a promise that
|
||||||
;; resolves to the API results.
|
;; resolves to the API results.
|
||||||
@ -30,10 +33,14 @@
|
|||||||
(defn nearby
|
(defn nearby
|
||||||
([config lat lon options]
|
([config lat lon options]
|
||||||
(log-verbose "Performing nearby query %s %s %s" lat lon options)
|
(log-verbose "Performing nearby query %s %s %s" lat lon options)
|
||||||
(pelias-get (:url config) "nearby"
|
(p/let [start (now)
|
||||||
|
result (pelias-get (:url config) "nearby"
|
||||||
{:query (assoc options
|
{:query (assoc options
|
||||||
:point.lat lat
|
:point.lat lat
|
||||||
:point.lon lon)})))
|
:point.lon lon)})
|
||||||
|
end (now)]
|
||||||
|
(log-info "Nearby geo query took %s ms" (- end start))
|
||||||
|
result)))
|
||||||
|
|
||||||
|
|
||||||
;; Performs a pelias "reverse" query. Retuns a promise that resolves
|
;; Performs a pelias "reverse" query. Retuns a promise that resolves
|
||||||
@ -42,7 +49,11 @@
|
|||||||
(defn reverse
|
(defn reverse
|
||||||
([config lat lon options]
|
([config lat lon options]
|
||||||
(log-verbose "Performing reverse query %s %s %s" lat lon options)
|
(log-verbose "Performing reverse query %s %s %s" lat lon options)
|
||||||
(pelias-get (:url config) "reverse"
|
(p/let [start (now)
|
||||||
|
result (pelias-get (:url config) "reverse"
|
||||||
{:query (assoc options
|
{:query (assoc options
|
||||||
:point.lat lat
|
:point.lat lat
|
||||||
:point.lon lon)})))
|
:point.lon lon)})
|
||||||
|
end (now)]
|
||||||
|
(log-info "Reverse geo query took %s ms" (- end start))
|
||||||
|
result)))
|
||||||
|
Loading…
Reference in New Issue
Block a user