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

Consider including with-bindings support #54

Open
robert-stuttaford opened this issue Jan 11, 2023 · 2 comments
Open

Consider including with-bindings support #54

robert-stuttaford opened this issue Jan 11, 2023 · 2 comments

Comments

@robert-stuttaford
Copy link

Adding support for appears to be straight-forward:

bd54b96

All one has to do is set :bindings on the context within any :enter interceptor:

(def ^:dynamic *transacting-user-id* nil)

(defn transacting-user-interceptor []
  {:name  ::transacting-user
   :enter (fn [ctx]
            (let [user-id (get-in ctx [:request :user :db/id])]
              (update ctx :bindings merge {#'*transacting-user-id* user-id})))})

I don't know enough about the async mode to know whether this is sufficient for that use-case.

@jarppe
Copy link
Member

jarppe commented May 11, 2023

This is interesting, thank you. I will investigate this.

bnert added a commit to bnert/sieppari that referenced this issue Mar 30, 2024
Per metosin#54 in metosin/seippari, this commit
could be considered a starting point for supporting
bindings support in clojure.

The initial implementation used the starting
point @robert-stuttaford posted in the referenced
issue.

A tradeoff here, is that in order to support sync/async
w/ the various runtimes, using (bound-fn*) seems to be necessary
given the different thread pool implemenations. Counsequently,
there is a a perf hit needing to push/pop thread local vars. It
doesn't seem to be too much in the general case, but with manifold,
it seems to a an order of magnitude slower, though still in the
microseconds.
bnert added a commit to bnert/sieppari that referenced this issue Mar 31, 2024
Per metosin#54 in metosin/seippari, this commit
could be considered a starting point for supporting
bindings support in clojure.

The initial implementation used the starting
point @robert-stuttaford posted in the referenced
issue.

A tradeoff here, is that in order to support sync/async
w/ the various runtimes, using (bound-fn*) seems to be necessary
given the different thread pool implemenations. Counsequently,
there is a a perf hit needing to push/pop thread local vars. It
doesn't seem to be too much in the general case, but with manifold,
it seems to a an order of magnitude slower, though still in the
microseconds.
@bnert
Copy link

bnert commented Mar 31, 2024

Gave implementing this a go in #55. Didn't want to be that guy and post "what's the status on this?" 😆.

Thanks @robert-stuttaford, for the starting point 🙂!

bnert added a commit to bnert/sieppari that referenced this issue Apr 1, 2024
Per metosin#54 in metosin/seippari, this commit
could be considered a starting point for supporting
bindings support in clojure.

The initial implementation used the starting
point @robert-stuttaford posted in the referenced
issue.

A tradeoff here, is that in order to support sync/async
w/ the various runtimes, using (bound-fn*) seems to be necessary
given the different thread pool implemenations. Counsequently,
there is a a perf hit needing to push/pop thread local vars. It
doesn't seem to be too much in the general case, but with manifold,
it seems to a an order of magnitude slower, though still in the
microseconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants