PelionIoT / mbed-connector-api-python

python library for using connector.mbed.com
Apache License 2.0
2 stars 2 forks source link

75% of the time isDone() never completes #14

Open janjongboom opened 8 years ago

janjongboom commented 8 years ago

This drives me f&*@ crazy. I don't know if it's me or Connector or the Python lib, but 3/4 of the times my calls to getResponseValue do not complete. Have to restart the server and then sometimes it works, and then 2 minutes later it doesn't again.

janjongboom commented 8 years ago

Also #3 and #9 mean that I need to get an extra terminal, run killall python and all that kind of crap.

janjongboom commented 8 years ago

With Brian's lib everything runs just fine (also via long polling and same device), so I'm suspecting this library.

janjongboom commented 8 years ago

I have the feeling that if I get a notification for the device first, that it then works... But no clue if that's just random or an actual fact.

BlackstoneEngineering commented 8 years ago

if isDone() doesnt complete that means that connector never responds with the async-response. This is not the fault of this library but rather a connector issue.

BlackstoneEngineering commented 8 years ago

Also, i would suggest running your scripts in ipython and using ctrl+C to kill your apps, it works very very well that way

janjongboom commented 8 years ago

@BlackstoneEngineering So the weird thing is that with Brian's lib I don't have this problem. Always succeeds.

BlackstoneEngineering commented 8 years ago

I cant comment for brians libraries effectiveness, what I can tell you is that when an async-response-id is received it fills in the async object that matches it and sets isDone to true, if the response is never received from connector then the isDone() value is never set to true, plain and simple.

In short, its Connector. If you would like you can try to debug the issue you are seeing by turning on debug (.debug(True,"DEBUG") ). You can see the pending async-response-ID's in the .database['async'] dictionary. When a async-response-id is received the .database is checked and if the value is found then the cooresponding async object is updated and the asyncID is removed from the .database.