Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid request 'stitching' when span-reqs is not specified #143

Merged
merged 1 commit into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/taoensso/faraday.clj
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,7 @@

Only one global secondary index operation can take place at a time.
In order to change a stream view-type, you need to disable and re-enable the stream."
[client-opts table update-opts & [{:keys [span-reqs]
:or {span-reqs {:max 5}}}]]
[client-opts table update-opts & [{:keys [span-reqs]}]]
(let [table-desc (describe-table client-opts table)
status (:status table-desc)
update-opts (validate-update-opts table-desc update-opts)]
Expand Down Expand Up @@ -1147,7 +1146,7 @@
(fn [raw-req]
(as-map
(.batchGetItem (db-client client-opts)
(batch-get-item-request return-cc? raw-req))))]
(batch-get-item-request return-cc? raw-req))))]
(merge-more run1 span-reqs (run1 (batch-request-items requests))))))

(defn- write-request [action item] "Implementation detail."
Expand All @@ -1174,8 +1173,7 @@
:span-reqs - {:max _ :throttle-ms _} allows a number of requests to
automatically be stitched together (to exceed throughput limits, for example)."
[client-opts requests &
[{:keys [return-cc? span-reqs attr-multi-vs?] :as opts
:or {span-reqs {:max 5}}}]]
[{:keys [return-cc? span-reqs attr-multi-vs?] :as opts}]]

(binding [*attr-multi-vs?* attr-multi-vs?]
(let [run1
Expand Down Expand Up @@ -1268,8 +1266,7 @@
Ref. http://goo.gl/XfGKW for query+scan best practices."
[client-opts table prim-key-conds
& [{:keys [last-prim-kvs query-filter span-reqs return index order limit consistent?
return-cc?] :as opts
:or {span-reqs {:max 5}}}]]
return-cc?] :as opts}]]
(let [run1
(fn [last-prim-kvs]
(update-in
Expand Down Expand Up @@ -1344,8 +1341,7 @@
[client-opts table
& [{:keys [attr-conds last-prim-kvs span-reqs return limit total-segments
filter-expr
segment return-cc?] :as opts
:or {span-reqs {:max 5}}}]]
segment return-cc?] :as opts}]]

(assert (not (and filter-expr (seq attr-conds)))
"Only one of ':filter-expr' or :attr-conds should be provided")
Expand Down
3 changes: 2 additions & 1 deletion test/taoensso/faraday/tests/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@
{bulk-table {:prim-kvs {:group "group"
:id (range num-items)}
:attrs [:id]
:consistent? true}})
:consistent? true}}
{:span-reqs {:max 2}})
bulk-table set count)
(->> (far/query *client-opts*
bulk-table {:group [:eq "group"]
Expand Down