Increased the keep alive timer per google recommendation. Fixed map parsing error when pairs are not in map order.
This commit is contained in:
parent
2a36493281
commit
6b83c2ae36
|
@ -31,20 +31,6 @@
|
|||
(throw async-adapter/ConnectionClosedException)))
|
||||
(close [this]
|
||||
(.complete continuation)))
|
||||
|
||||
#_(defn- add-ssl-connector!
|
||||
"Add an SslSocketConnector to a Jetty Server instance."
|
||||
[^Server server options]
|
||||
(let [ssl-connector (SslSocketConnector.)]
|
||||
(doto ssl-connector
|
||||
(.setPort (options :ssl-port 8443))
|
||||
(.setKeystore (options :keystore))
|
||||
(.setKeyPassword (options :key-password)))
|
||||
(when (options :truststore)
|
||||
(.setTruststore ssl-connector (options :truststore)))
|
||||
(when (options :trust-password)
|
||||
(.setTrustPassword ssl-connector (options :trust-password)))
|
||||
(.addConnector server ssl-connector)))
|
||||
|
||||
(defn- add-ssl-connector!
|
||||
"Add an SslSelectChannelConnector to a Jetty Server instance."
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
"X-Content-Type-Options" "nosniff"
|
||||
}
|
||||
:base "/channel" ;; root for /test and /bind urls
|
||||
:keep-alive-interval 10 ;; seconds, keep less than session-time-out
|
||||
:session-timeout-interval 15 ;; seconds
|
||||
:keep-alive-interval 30 ;; seconds, keep less than session-time-out
|
||||
:session-timeout-interval 120 ;; seconds
|
||||
;; after this number of bytes a
|
||||
;; backchannel will always be closed
|
||||
:data-threshold (* 10 1024)
|
||||
|
@ -80,16 +80,18 @@
|
|||
queue
|
||||
(recur (pop queue) id)))))
|
||||
|
||||
|
||||
|
||||
;; Key value pairs do not always come ordered by request number.
|
||||
;; E.g. {req0_key1 val01, req1_key1 val11, req0_key2 val02, req1_key2 val12}
|
||||
(defn transform-url-data [data]
|
||||
(let [ofs (get data "ofs" "0")
|
||||
(let [ofs (get data "ofs" "0")
|
||||
pieces (dissoc data "count" "ofs")]
|
||||
{:ofs (Long/parseLong ofs)
|
||||
:maps (->> (for [[k v] pieces]
|
||||
(let [[_ n k] (re-find #"req(\d+)_(\w+)" k)]
|
||||
[n {k v}]))
|
||||
(partition-by first)
|
||||
(map #(into {} (map second %))))}))
|
||||
(group-by first) ; {0 [[0 [k1 v2]] [0 [k2 v2]]],1 [[1 [k1 v1]] [1 [k2 v2]]]}
|
||||
(map #(into {} (map second (val %)))))}))
|
||||
|
||||
(assert (= {:ofs 0 :maps [{"x" "3" "y" "10"} {"abc" "def"}]}
|
||||
(transform-url-data {"count" "2"
|
||||
|
|
Reference in a new issue