mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
Fix returned status in /search/result
This commit is contained in:
@@ -23,6 +23,7 @@ func (api *WebapiInstance) dispatchSearch(input SearchRequest) (job *SearchJob)
|
||||
job = CreateSearchJob(Timeout, input.MaxResults, Filter)
|
||||
|
||||
// todo: create actual search clients!
|
||||
job.Status = SearchStatusLive
|
||||
|
||||
go job.localSearch(api, input.Term)
|
||||
|
||||
@@ -33,6 +34,7 @@ func (api *WebapiInstance) dispatchSearch(input SearchRequest) (job *SearchJob)
|
||||
|
||||
func (job *SearchJob) localSearch(api *WebapiInstance, term string) {
|
||||
if api.backend.SearchIndex == nil || api.backend.GlobalBlockchainCache == nil {
|
||||
job.Status = SearchStatusNoIndex
|
||||
return
|
||||
}
|
||||
|
||||
@@ -75,6 +77,8 @@ resultLoop:
|
||||
job.statsAdd(&newFile)
|
||||
}
|
||||
|
||||
job.Status = SearchStatusTerminated
|
||||
|
||||
job.ResultSync.Unlock()
|
||||
job.Terminate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user