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

Find async or non-async client #57

Closed
sagikazarmark opened this issue Jun 3, 2016 · 12 comments
Closed

Find async or non-async client #57

sagikazarmark opened this issue Jun 3, 2016 · 12 comments

Comments

@sagikazarmark
Copy link
Member

In some cases it doesn't matter if the installed client is sync or async (for example when known to be used in PluginClient). For that we could have a discovery which finds a sync or async client.

@dbu
Copy link
Contributor

dbu commented Jun 3, 2016 via email

@sagikazarmark
Copy link
Member Author

Actually, I was thinking about the same 😄

But it would still be useful as a snippet somewhere.

@dbu
Copy link
Contributor

dbu commented Jun 3, 2016 via email

@joelwurtz
Copy link
Member

joelwurtz commented Jun 29, 2016

Or we could add an argument to the find method where we allow emulated client

HttpAsyncClientDiscovery::find($allowEmulation = false);

So if no async client is found and allowEmulation is set to true it use the SyncClient Discovery and encapsulate it with an emulated async client.

WDYT ?

@Nyholm
Copy link
Member

Nyholm commented Jun 29, 2016

The only time you use HttpAsyncClientDiscovery::find() is when you are a library author. If you are a application author and writing your own code then you probably do not use discovery at all.

As a library author you usually do not care if the client is emulated or not, you just want the async client api.

The only time you care is if you are an application author using a library that is using HttpAsyncClientDiscovery::find(). Then you want to make sure discovery will find an async client. With that said, we cant have any special parameters to find() nor can you have a special HttpAsyncClientDiscovery::findNoEmulated().

What I propose is that we, by default, are trying to find all real async clients and then fallback on emulated ones.

@sagikazarmark
Copy link
Member Author

I would rather keep it simple and let the developer handle the situation. We don't know the preference of a given code. Adding emulation related code to the discovery adds an extra dependency (client-common) and complexity.

@dbu
Copy link
Contributor

dbu commented Jun 30, 2016 via email

@Nyholm
Copy link
Member

Nyholm commented Jun 30, 2016

Okey. Big -1 for adding more dependency.

The situation we have not covered is when I as a library developer what to emulate a async client. I believe I can write an extra strategy for that that we let the users opt-in to.

@Nyholm
Copy link
Member

Nyholm commented Jun 30, 2016

I just added #65. I as a application author may write a strategy like that. What I want to push in is the support for a strategy to return a candidate with a closure.

What do you think? That would make the discovery super flexible, but... could it be too flexible?

@dbu
Copy link
Contributor

dbu commented Jul 18, 2016

do we still need to do something about this or is it good enough as is?

@sagikazarmark
Copy link
Member Author

We agreed to add a cookbook entry

@dbu
Copy link
Contributor

dbu commented Jul 18, 2016

@dbu dbu closed this as completed Jul 18, 2016
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

4 participants