Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
e5644bc7
Commit
e5644bc7
authored
Apr 17, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
query: avoid a goroutine in ResultsWithEntries
parent
0f659c79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
query/query.go
query/query.go
+10
-13
No files found.
query/query.go
View file @
e5644bc7
...
...
@@ -245,22 +245,19 @@ func ResultsWithProcess(q Query, proc func(goprocess.Process, chan<- Result)) Re
// ResultsWithEntries returns a Results object from a list of entries
func
ResultsWithEntries
(
q
Query
,
res
[]
Entry
)
Results
{
b
:=
NewResultBuilder
(
q
)
// go consume all the entries and add them to the results.
b
.
Process
.
Go
(
func
(
worker
goprocess
.
Process
)
{
for
_
,
e
:=
range
res
{
select
{
case
b
.
Output
<-
Result
{
Entry
:
e
}
:
case
<-
worker
.
Closing
()
:
// client told us to close early
return
i
:=
0
return
ResultsFromIterator
(
q
,
Iterator
{
Next
:
func
()
(
Result
,
bool
)
{
if
i
>=
len
(
res
)
{
return
Result
{},
false
}
}
return
next
:=
res
[
i
]
i
++
return
Result
{
Entry
:
next
},
true
},
})
}
go
b
.
Process
.
CloseAfterChildren
()
return
b
.
Results
()
}
func
ResultsReplaceQuery
(
r
Results
,
q
Query
)
Results
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment