PelionIoT / mbed-connector-api-python

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

100% CPU while waiting for response #9

Open janjongboom opened 8 years ago

janjongboom commented 8 years ago

I use this w/o a notification channel:

        e = connector.getResourceValue(id, KNOCK_RESOURCE)
        while not e.isDone():
            time.sleep(0.1)
        if e.error:
            raise Error(e.error)
        pprint.pprint(e.raw_data)

This spins the CPU at 100% and never completes.

janjongboom commented 8 years ago

Now it also happened with a notification channel, no clue what is going on here.

BlackstoneEngineering commented 8 years ago

You have provided insufficient information for debug. The first chunk of code will not complete, nothing in the library will work without a notification channel.

janjongboom commented 8 years ago

I know it won't complete, I don't have a notification channel.

However, that does not mean this library should just eat 100% CPU.

BlackstoneEngineering commented 8 years ago

Agreed, do you have a proposed solution?

janjongboom commented 8 years ago

I don't really know why Python eats 100% CPU here. Maybe sleep(1) instead of None? Haven't tested this.

BlackstoneEngineering commented 8 years ago

Kk i will add it to the list of things to investigate during the quarterly review