Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout的bug #67

Closed
eruca opened this issue Mar 5, 2017 · 0 comments
Closed

timeout的bug #67

eruca opened this issue Mar 5, 2017 · 0 comments

Comments

@eruca
Copy link

eruca commented Mar 5, 2017

// 设置超时
		deadline := time.Now().Add(time.Nanosecond * time.Duration(NumNanosecondsInAMillisecond*request.Timeout))
		for shard := 0; shard < engine.initOptions.NumShards; shard++ {
			select {
			case rankerOutput := <-rankerReturnChannel:
				if !request.CountDocsOnly {
					for _, doc := range rankerOutput.docs {
						rankOutput = append(rankOutput, doc)
					}
				}
				numDocs += rankerOutput.numDocs
			case <-time.After(deadline.Sub(time.Now())):
				isTimeout = true
				break
			}
		}

如果设置了超时,而且确实是超时了,那么进入 下面那条case了,那么原来的rankerReturnChannel要返回的rankerOut就无法正常返回了,阻塞了,而且会影响下次search的结果会返回上次是结果

@eruca eruca closed this as completed Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant