webapi: Fix bug in search job.

This commit is contained in:
Kleissner
2021-12-29 16:57:07 +01:00
parent 0493acce64
commit 38d411bb9a
3 changed files with 22 additions and 26 deletions

View File

@@ -26,7 +26,7 @@ func (api *WebapiInstance) dispatchSearch(input SearchRequest) (job *SearchJob)
go job.localSearch(api, input.Term)
job.RemoveDefer(job.timeout + time.Minute*10)
api.RemoveJobDefer(job, job.timeout+time.Minute*10)
return job
}
@@ -55,10 +55,10 @@ resultLoop:
}
}
if bytes.Equal(file.NodeID, job.backend.SelfNodeID()) {
if bytes.Equal(file.NodeID, api.backend.SelfNodeID()) {
// Indicates data from the current user.
file.Tags = append(file.Tags, blockchain.TagFromNumber(blockchain.TagSharedByCount, 1))
} else if peer := job.backend.NodelistLookup(file.NodeID); peer != nil {
} else if peer := api.backend.NodelistLookup(file.NodeID); peer != nil {
// add the tags 'Shared By Count' and 'Shared By GeoIP'
file.Tags = append(file.Tags, blockchain.TagFromNumber(blockchain.TagSharedByCount, 1))
if latitude, longitude, valid := api.Peer2GeoIP(peer); valid {