sonyxperiadev / pygerrit

MIT License
52 stars 51 forks source link

Avoid busy loop when receiving incoming stream data. #13

Closed EnJens closed 11 years ago

EnJens commented 11 years ago

Checking whether bytes are available is a non-blocking operation, causing the receive loop to become a busy loop.

The busy loop essentially takes up a full cpu 100% of the time.

Perhaps this should be tied to a blocking setting?

dpursehouse commented 11 years ago

Thanks.

I have a few more commits to push out to master, then I'll merge this on top. Probably tomorrow.

dpursehouse commented 11 years ago

I'll look at this again tomorrow.

in the meantime, please feel free to add yourself into the AUTHORS.rst file that I just added.

EnJens commented 11 years ago

I'm not quite sure what happens right now if the server shuts down - I don't have a test setup to try it on atm (only production).

I'll add myself to AUTHORS :) If you're interested in what we're using pygerrit for, it's for www.omnirom.org - automatic build verifyer (https://github.com/omnirom/omni_tools_Bot) and soon automatic adding of reviewers depending on projects. Quite necessary when you get lots of external changes coming in!

dpursehouse commented 11 years ago

I'm not quite sure what happens right now if the server shuts down

When running example.py and the Gerrit server is shut down cleanly by running the ./bin/gerrit.sh stop command, it looks like this:

2013-10-18 09:50:09,925 INFO Event: <ErrorEvent: No JSON object could be decoded>
2013-10-18 09:50:09,926 ERROR No JSON object could be decoded
2013-10-18 09:50:09,926 ERROR Exited with error

I haven't fully tested what happens when the ssh connection drops for some other reason.

automatic build verifyer

Nice :)