Skip to content

Added asynchronous guzzle calls #9

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

t0k4rt
Copy link
Contributor

@t0k4rt t0k4rt commented Mar 31, 2014

Hi,
I just added an option to make async calls with guzzle. Should be interesting if you don't want to wait for google to respond !

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 2, 2014

Hi just to add some details about this pr,
The PR passes the tests correctly (it's an issue with travis which sometimes fails to install correctly composer dependencies)
I did some benchs, the async option is really a must have since the connection time is more than twice lower than without async calls (from 175ms to 60ms on first connection)

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 3, 2014

@krizon Actually after some tests, there is an issue, Google doesn't like this async mode :-/, I don't know why but I need to get the response to get a correct event. that's bad news :(
I guess the best way to have real async is to use a task queue,
the function "register_shutdown_function" works well but it's not real async ...

@krizon
Copy link
Owner

krizon commented Apr 28, 2014

@t0k4rt i've just added a test to this branch locally to perform some real async calls to a test GA property and they seem to be logged correctly. What problems where you encountering?

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

Hi,
I just checked another time to be sure, when I use in config the option 'async' => true
I get no hits in google real time view.
It could be related to a different curl version since we have the same code ?

@krizon
Copy link
Owner

krizon commented Apr 28, 2014

Just to be sure, you test with --group=internet and you've set the correct tracking_id in the phpunit.xml(.dist)? I'll open a PR which includes test with real calls to GA. Would appreciate it if you would test that PR.

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

Actually I tested the lib directly in a piece of code, not with phpunit.
I just went through the tests, when you live test, the async option is by default on false.
In the test I added to the lib, I was just checking that the async plugin was well loaded.
I should write a test that test with the async option on true

@krizon
Copy link
Owner

krizon commented Apr 28, 2014

@t0k4rt added the test in PR: t0k4rt#1

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

I launched the new tests, I think I should have two pageview (one without asyn, one with async) , I only get one hit.

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

On your side do you see 2 hits ?

@krizon
Copy link
Owner

krizon commented Apr 28, 2014

I see:
/php-ga-measurement-protocol/phpunit-test
/php-ga-measurement-protocol/phpunit-test/async

So you're on krizon/async-request and you see the method testAsyncRequestLive? And you are viewing the following report: Real-Time -> Content -> Pageviews (Last 30 min)?

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

Yes I'm on the right analytics page, I only see this one :
/php-ga-measurement-protocol/phpunit-test

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

I updated my packages in case and restarted my webserver ... still nothing ...
In case, what's your config ?
I'm on linux ubuntu with nginx / php-fpm

@krizon
Copy link
Owner

krizon commented Apr 28, 2014

CentOs with Apache/2.2.15

cURL Information => 7.19.7

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

I'm on curl 7.22.0, I'm going to try with 7.19.7 version just in case.

@t0k4rt
Copy link
Contributor Author

t0k4rt commented Apr 28, 2014

Actually this version of the package is not available on ubuntu, I can't try it :-/
I tried on another vm with apache2.4.9 / curl 7.22.0 but same result ...

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