Long delay POST to agent

I see long delay between POSTing to Agent like very slow internet on last few days.
All electricimp related webpages (including forum) also are slow.
Internet speed is OK as I have tested.
Some upgrade take place?

It’s dependent on the IS Provider. I have had problems with Verizon DSL and DISH network, because of the ping times?

@sbright33 , not sure that it is internet provider - I tested mobile as well as other - optical. Both are slow for imp… :frowning:

The forums are still on dreamhost, which explains their slowness. We do plan on moving them to amazon at some point.

No known issues with imp performance that I’m aware of; I just checked out both agent and HTTP in performance and it looked fine.

What does a “ping agent.electricimp.com” show from your end?

@Hugo, I do not really know where I must place code for ping… :frowning:
First POST have a normal speed, following are delayed for 5…10…30 seconds.

I suppose that I find a problem. Design contain POST in both directions. Agent POST goes to sever accidentally turned OFF. Turning server ON or disabling lines in code bring things back to normal.

Glad it’s working but I don’t quite understand what you were doing :slight_smile:

Hmmm…:slight_smile: Here is agent code:

http.onrequest(function(req, resp){
if (req.method == “POST”){
local body = http.urldecode(req.body)
local value = (body.data).tofloat();
device.send(“set”, value);
resp.send(200, "OK "+ value);

device.on(“set_is”, function(a) {
local resp = http.post(“http://xxxxxxxx/impweb.php”,
http.urlencode({coord = a})).sendsync();

If server Agent try to POST “http://xxxxxxxx/impweb.php” is OFF, a long delay occurs. Disabling this part of code or turning server ON help to exclude delay.

Oh, yes. You are doing a sendsync() which means the agent will not do anything else until that request has completed (or timed out). Makes sense now!

Yes, Hugo, thanks! I try it in practice:)
Is there some method to identify such situation and send a message? Or - response for sendsync()?

Well, the real fix is to do an async send, and then it won’t stop other things happening. When the request finally succeeds (or times out) the async callback function will be run.

I see, Thanks Hugo!:slight_smile: