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

fix cloud connection bug after transacting with subsequent queries in… #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions src/com/cognitect/vase/actions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@

`headers` is an expression that evaluates to a map of header
name (string) to header value (string). May be nil."
[code-gen properties db-op headers to]
[code-gen properties db-op headers to cloud?]
(assert (or (nil? headers) (map? headers)) (str "Headers should be a map. I got " headers))
(let [to (or to ::transact-data)]
`(fn [{~'request :request :as ~'context}]
Expand All @@ -481,15 +481,15 @@
(assoc ~'context :response resp#)
(assoc-in
~(assoc-or-assoc-in 'context to 'response-body)
[:request :db] (d/db conn#)))))))
[:request :db] (if ~cloud? (client/db conn#) (d/db conn#))))))))

(defrecord TransactAction [name properties db-op headers to doc]
i/IntoInterceptor
(-interceptor [_]
(dynamic-interceptor
name
{:enter
(transact-action-exprs (peer-code-gen) properties db-op headers to)
(transact-action-exprs (peer-code-gen) properties db-op headers to false)

:action-literal
:vase.datomic/transact})))
Expand All @@ -503,7 +503,7 @@
(dynamic-interceptor
name
{:enter
(transact-action-exprs (cloud-code-gen) properties db-op headers to)
(transact-action-exprs (cloud-code-gen) properties db-op headers to true)

:action-literal
:vase.datomic.cloud/transact})))
Expand Down