2 minute delay after getreq.sendsync()

In my agent, I am sending data to a php script (which then uses curl to post some data back to the imp).

I am able to successfully post and get but the delay is significant.
The relevant code is:
server.log("URL: " + mysqlURL); local getreq = http.get(mysqlURL); server.log("about to send request"); local res = getreq.sendsync(); server.log("Status response: " + res.statuscode); server.log("Response body: " +res.body);

With the output as:

Tue Aug 13 2013 12:18:58 GMT-0400 (EDT): URL: http://myserver/ElectricImp/FromImptoSQL.php?col1=2&col2=2&col3=5&col4=5&col5=7&col6=7&impserial=1 Tue Aug 13 2013 12:18:58 GMT-0400 (EDT): about to send request Tue Aug 13 2013 12:20:59 GMT-0400 (EDT): Status response: 200 Tue Aug 13 2013 12:20:59 GMT-0400 (EDT): Response body: This is from the webpage....

Is this an issue with my code or an imp limitation?

Note: When I run the php script in my webpage it takes seconds to run and send the data to my imp (so I’m almost positive the error is not with my php script and the imp code receiving the post).

Hi AllieCat,

The agent is single threaded. If you are GETting a web page, the thread is busy. It is not able to respond to a HTTP request at the same time. You should, if possible, be responding to the GET request with the data rather than posting it to the agent URL. If that’s not possible then you will need to wait for the HTTP GET request to complete before posting to the agent.

 A.

Hi again,

You could also try sendasync(). Depending on what your code looks like, this should allow you to get the results, although this will be delayed until the agent is idle.

 A.