-
Notifications
You must be signed in to change notification settings - Fork 125
Delay driver instantiation until it's actually needed. #68
Conversation
This essentially removes the dependency on Guzzle if you use an alternative driver implementation.
This change is totally good but I am not sure that this kind of change can fit in the current stable version of the SDK. I am in my mind a version 2 totally agnostic about guzzle but I am not really on it right know. @pprkut can you show me your use case? |
My use case is move-backend@d167936, a driver using https://github.com/rmccue/Requests instead of Guzzle. Not sure how that would fit in with your planning for v2 though. |
#69 will be merged and released soon.. Just time to have a refactoring and make a release. This one requires a little bit of time more sorry |
That's totally fine. We have our fork to use in the meantime. But the general idea would still be to get this (and the Requests driver) upstream at some point :) |
IMO it would be a good idea to decouple next major version influxdb-php from the actual http driver implementation. HTTPlug would be perfect for this. Only bad thing is that it does not support UDP. |
I would still like to have this :) |
@pprkut the thing is it's not really friendly in terms of performance when you have a huge number of queries since you are creating an object every time. Can i suggest you move driver to a static property of the client class (and check if it's already instantiated). If you make this change and check the tests i can merge it. |
The behavior of how many objects are created didn't change. The only change is when it is instantiated. This code won't create a new driver object every time you call |
My bad, you are right. LGTM |
@pprkut thanks! |
This essentially removes the dependency on Guzzle if you use
an alternative driver implementation. "Essentially" since the tests
are pretty hard-wired to Guzzle, but runtime-wise it wouldn't be
needed anymore.