From f401c42f9c22de9df7a40ee31727ff0eab5dd30e Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 8 Jan 2015 22:07:04 +0900 Subject: Adjust initial coordinator delay --- src/core.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/core.go') diff --git a/src/core.go b/src/core.go index b6f08572..5a81efa3 100644 --- a/src/core.go +++ b/src/core.go @@ -7,7 +7,8 @@ import ( "time" ) -const COORDINATOR_DELAY time.Duration = 100 * time.Millisecond +const COORDINATOR_DELAY_MAX time.Duration = 100 * time.Millisecond +const COORDINATOR_DELAY_STEP time.Duration = 10 * time.Millisecond func initProcs() { runtime.GOMAXPROCS(runtime.NumCPU()) @@ -151,8 +152,11 @@ func Run(options *Options) { } } }) - if ticks > 3 && delay && reading { - time.Sleep(COORDINATOR_DELAY) + if delay && reading { + dur := DurWithin( + time.Duration(ticks)*COORDINATOR_DELAY_STEP, + 0, COORDINATOR_DELAY_MAX) + time.Sleep(dur) } } } -- cgit v1.2.3