From e808151c287513c9aef35be339b10a2861115ade Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 18 Feb 2015 00:08:17 +0900 Subject: Make --select-1 and --exit-0 asynchronous --- src/matcher.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/matcher.go') diff --git a/src/matcher.go b/src/matcher.go index bbd9c890..84130b23 100644 --- a/src/matcher.go +++ b/src/matcher.go @@ -86,7 +86,7 @@ func (m *Matcher) Loop() { } if !foundCache { - merger, cancelled = m.scan(request, 0) + merger, cancelled = m.scan(request) } if !cancelled { @@ -121,7 +121,7 @@ type partialResult struct { matches []*Item } -func (m *Matcher) scan(request MatchRequest, limit int) (*Merger, bool) { +func (m *Matcher) scan(request MatchRequest) (*Merger, bool) { startedAt := time.Now() numChunks := len(request.chunks) @@ -175,10 +175,6 @@ func (m *Matcher) scan(request MatchRequest, limit int) (*Merger, bool) { count++ matchCount += matchesInChunk - if limit > 0 && matchCount > limit { - return nil, wait() // For --select-1 and --exit-0 - } - if count == numChunks { break } -- cgit v1.2.3