Fix an issue where varnishcount would undercount on low traffic.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 17 Jun 2015 21:43:58 +0000 (23:43 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 17 Jun 2015 21:43:58 +0000 (23:43 +0200)
commitb1f81e7a5ced71f79b3d3b2212977c3901352b21
tree3832f342d1b1d2d3f8f9906ac0a1d92b3a9b5c78
parent1c8a5757b9a7c3c694ed3c1c43f7c60a1e4ce84d
Fix an issue where varnishcount would undercount on low traffic.

Basically AnyEvent and line buffering is tricky; we could end up
reading only the first line even though there were many more ready,
causing us to see the lines from varnishncsa lines way too late
and thus oscillating between ~30 and ~0 viewers.

It's crazy that you need to fiddle with push_read() in the read
callback instead of just being able to set line => directly in the
constructor, but this is seemingly the right idiom.
varnishcount.pl