Possible status_code bug

Post your questions and help other users.

Moderator: Martin

Post Reply
mec
Posts: 4
Joined: 22 Oct 2014 07:52

Possible status_code bug

Post by mec » 22 Oct 2014 08:55

Hello,
I've created an automagic task to check my mail (see attached). Basically, it does the following:
1. checks if it can reach internet
2. if not, based on {status_code} variable, it will connect the second sim on data
3. sync emails
4. if connected to second sim data, turn off data
5. sleep a period of time
6. goto 1

The issue that I experience is that after I execute the following:
1. Automagic flow is in the sleep state (step 5)
2. Manually connect to internet via wireless to do some other stuff
3. Meanwhile the automagic flow is executed and back to sleep (steps 1-5)
4. Somewhere later disconnect from wireless

I get only status_code == 200 in step 1 (even if it's NOT connected to any kind of data 3g/wireless).

Am I doing something wrong?
Thank you
Attachments
periodical_mail_check.xml
Automagic premium flow for periodic mail check
(12.99 KiB) Downloaded 740 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Possible status_code bug

Post by Martin » 22 Oct 2014 16:40

Hi,

Action HTTP Request should not return code 200 when the request fails.
Could you please send the log to me after reproducing the problem so I can check what happened on your device (menu->Manage->Log, Menu->Send Log)?

Regards,
Martin

User avatar
Bushmills
Posts: 286
Joined: 23 Sep 2014 21:56

Re: Possible status_code bug

Post by Bushmills » 22 Oct 2014 18:01

You're periodically polling in your flow whether your device is online?
Possible this can be solved in a more elegant way:
Use a trigger which gets active when network connection is established. One way to respond to this event is to activate another flow, which does the periodic syncing, maybe by timer trigger. Upon disconnect from network, disable that flow again.
This avoids having to check for network connectivity yourself - and consequently, may eliminate your problem.

mec
Posts: 4
Joined: 22 Oct 2014 07:52

Re: Possible status_code bug

Post by mec » 23 Oct 2014 07:27

Hello again,

@Martin: I attach here the log I have. I didn't sent it through application because I made this log a few days ago with debug log. I've blurred out the emails I'm synchronizing. Meanwhile I've upgraded to 1.24 (previous 1.23), the issue still happening.
The log contains actions executed across 1 or 2 flow runs, with status_code already 200, in disconnected network state.
Just to be clear again:
1. As long as the flow runs without connecting to wireless, everything is fine
2. If I am connected to wireless doing something else, the flow runs and gets to sleep and I disconnect the wireless, afterwards I get status_code 200
3. If I stop the flow and execute it again, everything it's fine until 2. above
Hopefully, I am clear about the issue I have. I am a programmer, so it might not be a wired thing that a dog could explain better :)

@Bushmills
I understand that there are some other ways around it (for the moment, I switched to 'Periodic timer' and everything is good), but it seems to me that some wired bug it's happening so I just want to check it.

Thank you guys for your interest.
Attachments
log.txt
Debug log, status_code=200, disconnected network
(51.95 KiB) Downloaded 669 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Possible status_code bug

Post by Martin » 24 Oct 2014 07:54

Hi,

Maybe I understand whats going on:
-variable status_code is set at some point in time to 200 and passed to the parent flow (Mail check every 30m)
-network becomes unreachable
-action HTTP Request fails with an error since the request can not even be sent
-variable status_code stays at 200 since the action does not set the status code when the request can not be sent

Could you please try to reset the status code before the child flow is executed, either in flow Mail check every 30m with status_code=null or using an additional action Script: status_code=null in the child flow and see if this fixes the problem?

Regards,
Martin

mec
Posts: 4
Joined: 22 Oct 2014 07:52

Re: Possible status_code bug

Post by mec » 26 Oct 2014 08:49

Hi Martin,
As expected, it works.
But to be true, I was expecting that variables used by actions to be used in a 'read only' style.
Is this a workaround or a state of fact?
Thank you.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Possible status_code bug

Post by Martin » 26 Oct 2014 11:15

Variables in Automagic can always be overwritten by a script. The irritating thing in this case was that the variables are passed to the parent flow which passes the variables to the child flow in the next invocation so status_code will be available in the child flow even when the action fails with an error. I think that the action HTTP Request should set the status_code to null when the action fails with a connectivity problem. I will change this in the next version.

mec
Posts: 4
Joined: 22 Oct 2014 07:52

Re: Possible status_code bug

Post by mec » 26 Oct 2014 12:59

Cool. Sounds good. Actually that was the natural behaviour I was expecting.
Thank you for this wonderful app.

Post Reply