Skip to content

Commit

Permalink
Rename conn-timeout to connection-timeout & bump default to 2 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankApiyo committed May 6, 2022
1 parent 0af2fe4 commit ba863a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/milia/api/io.clj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
([] (build-req nil))
([http-options]
(assoc (req+auth (or http-options {}))
:conn-timeout (:conn-timeout @timeouts)
:connection-timeout (:connection-timeout @timeouts)
:socket-timeout (:socket-timeout @timeouts)
:save-request? debug-api?
:debug debug-api?
Expand Down
13 changes: 6 additions & 7 deletions src/milia/utils/remote.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,20 @@
#?(:clj (defn read-env-string
"Read a string using env return nil if nil."
[k]
(if-let [v (env k)] (read-string v))))
(when-let [v (env k)] (read-string v))))

#?(:clj (def debug-api? (read-env-string :debug-api)))
#?(:clj (def http-default-per-route
(read-env-string :milia-http-default-per-route)))
#?(:clj (def http-threads (read-env-string :milia-http-threads)))

(def images-url
#?(:clj "images.ona.io"
:cljs (str "images." (aget js/window "location" "hostname"))))
#?(:clj "images.ona.io"
:cljs (str "images." (aget js/window "location" "hostname"))))

(def hosts
"Store remote hosts that requests are made to."
(atom {
;; used to create URLs that return to the client
(atom {;; used to create URLs that return to the client
:client "zebra.ona.io"
;; Ona compatible API to request data from
:data "stage-api.ona.io"
Expand All @@ -47,8 +46,8 @@

(def timeouts
"Store customizable timeouts to use in the http libraries. In milliseconds."
(atom {:conn-timeout 60000
:socket-timeout 60000}))
(atom {:connection-timeout 120000
:socket-timeout 120000}))

(defn ^:export set-hosts
"Swap values into hosts atom, requires data-host, other args are option but
Expand Down
2 changes: 1 addition & 1 deletion test/clj/milia/api/io_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(def auth-token "auth token for external api")
(def options
{:socket-timeout (:socket-timeout @timeouts)
:conn-timeout (:conn-timeout @timeouts)
:connection-timeout (:connection-timeout @timeouts)
:save-request? debug-api?
:debug debug-api?
:debug-body debug-api?})
Expand Down

0 comments on commit ba863a8

Please sign in to comment.