bergie/dnode-php — pull request #6 by skenqbx (2012-03-22 23:32:58+00:00)
Title: dynamic throttle for main loop

Hello,

while using a php client with node.js server, i stumbled upon 100% cpu usage for the client.

To prevent this behavior for idle clients i added idle checks for empty `select()` calls, empty `$readables` and empty `$client->requests`. If `$emptySelectCount` hits `$emptySelectThreshold` the `$interval` is incremented by `$intervalStep` and the count is reset.

If the loop checks out, **not** to be idle, the interval is reset. Otherwise the interval is incremented until it hits `$intervalMax`.

**This patch needs review**, and still some means of configuration.

Looking forward to your feedback.