antirez/redis — pull request #2063 by bbgordon (2014-10-13 23:35:35+00:00)
Title: Sample output buffer size after removing data, not just after adding

Suppose a client periodically receives 8MB messages, but rarely anything smaller, and has a soft limit of 8mb in 60 seconds. obuf_soft_limit_reached_time currently only gets checked when adding to the buffer, not removing from it. Even if the client reads each message in well under 60 seconds, the next time a message gets published obuf_soft_limit_reached_time is still set. checkClientOutputBufferLimits thinks the soft limit's been exceeded ever since the first message was published and disconnects the client.

This adds a check after sending data, too, recognizing when the buffer shrinks between writes.