Alright I have absolutely confirmed this behaviour. (Now with a different return code than 0)
There is some kind of time limited caching going on I think?
I have a test script in node.js using the javascript client.
The test entails calling many functions in quick succession, I have debug code that outputs a single publish when a function is run on the device.
So I can run the test and see the debug outputs:
{ id: '...',
last_app: '',
connected: true,
return_value: 1024 }
{ id: '...',
last_app: '',
connected: true,
return_value: -2 }
{ id: '...',
last_app: '',
connected: true,
return_value: -2 }
...bunch of other calls, the last result code is 1024 success
and in another window the subscribe mine
{"name":"/log/debug/getconfirm","data":"getclaim ran","ttl":"60","published_at":"2015-09-30T21:41:23.578Z","coreid":"..."}
{"name":"/log/debug/getconfirm","data":"getclaim ran","ttl":"60","published_at":"2015-09-30T21:41:24.435Z","coreid":"..."}
{"name":"/log/debug/getconfirm","data":"getclaim ran","ttl":"60","published_at":"2015-09-30T21:41:26.339Z","coreid":"..."}
...
Now if I run the same test again immediately I will get
{ id: '...',
last_app: '',
connected: true,
return_value: 1024 }
{ id: '...',
last_app: '',
connected: true,
return_value: 1024 }
{ id: '...',
last_app: '',
connected: true,
return_value: 1024 }
Which is impossible, there should be two -2 results after the first 1024.
And there are no debug outputs so I know my function has not run on the device, but the cloud is giving me some kind of “cached” return_value
I can reset the device or wait a while, and it will work properly again.
At first this feels like an http caching problem to me, but I am not entirely sure why resetting device would fix it. Or what is triggering the “cache” only responses at some point.