unbit/uwsgi — pull request #17 by prymitive (2012-10-07 19:05:11+00:00)
Title: Tracking requests per minute in subscriptions

Changes is this patch:

* it enables subscription system to track number of requests per minute, it's calculated every clock minute. Counters are being adjusted on every request, if there was no request for this node in last minute, then it will be zeroed on next subscription ping from this node. This is exported as **rpm** key in stats socket.
* nodes now have **subscribed** key exported in stats socket, it contains timestamp of when this node subscribed to our router. This is for monitoring purposes.
* last feature is a fix for (w)lrc behaviour of trying to catch up new nodes requests counter with other nodes. If You have few nodes running Your app for very long time, and then You add new node, then (w)lrc will favor this node when this check:

```
if (min_rc == 0 && !(node->next && node->next->reference <= node->reference && node->next->requests <= node->requests))
```

To fix this I'm using node->rpm_counter (number of requests in current minute) instead of request counter since subscription.