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

Add :async-future as an option for async request processing #516

Closed
wants to merge 2 commits into from

Conversation

rymndhng
Copy link
Collaborator

@rymndhng rymndhng commented Sep 5, 2019

Solves #512.

Notes for Reviwer:
I chose to add a separate option :async-future instead of changing the existing :async implementation to avoid breaking API changes.

Copy link
Owner

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple of comments, I see this is a draft though, so I didn't know if it's ready for review.

[req [respond raise]]
(if (opt req :async)
[req & [respond raise]]
{:pre [(not (and (:async req) (:async-future req)))]}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should use (opt req :async) and (opt req :async-future) so they support the optional ? suffix

(opt req :async-future)
(let [basic-future (org.apache.http.concurrent.BasicFuture. nil)]
(request (-> req
(dissoc :async-future)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to avoid having multiple options I think this should be:

Suggested change
(dissoc :async-future)
(dissoc :async :async? :async-future :async-future?)

@rymndhng
Copy link
Collaborator Author

rymndhng commented Oct 2, 2019

I left a couple of comments, I see this is a draft though, so I didn't know if it's ready for review.

Sorry for the delay, I've taken your suggestions -- it is ready for review now :)

@rymndhng
Copy link
Collaborator Author

rymndhng commented Dec 10, 2019

One thing I really don't like about the approach here is that there is no way to generalize this functionality to clj-http.client/request. The alternative solution #527 does not have this drawback.

For that reason, I'm going to close this PR.

@rymndhng rymndhng closed this Dec 10, 2019
@rymndhng rymndhng deleted the async-future-3.x branch December 10, 2019 23:42
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

Successfully merging this pull request may close these issues.

2 participants