flowchartsman opened a new issue #438:
URL: https://github.com/apache/pulsar-client-go/issues/438
I am creating a reader to stream the last <time period> of function output
messages to a browser connection:
```go
eader, err := s.pclient.CreateReader(
pulsar.ReaderOptions{
Topic: common.TopicName(common.Tenant,
common.NamespaceAgent, uuid),
StartMessageID: pulsar.EarliestMessageID(),
Name: fmt.Sprintf("results_%s_%d",
uuid, time.Now().UnixNano()),
},
)
if err != nil {
respond(w, errorResponse("failed to create reader:
"+err.Error()), http.StatusInternalServerError)
return
}
if err := reader.SeekByTime(time.Now().Add(-1 * time.Hour));
err != nil {
respond(w, errorResponse("failed to seek reader:
"+err.Error()), http.StatusInternalServerError)
return
}
defer reader.Close()
w.Write([]byte(resultsStart))
for reader.HasNext() {
msg, err := reader.Next(rctx)
if err != nil {
// if we encounter an error, add a dummy dict
in case there's a comma, then close the list and add the error to the response
fmt.Fprintf(w, `{}],"error":"error during
results iteration: %s"}`, err)
f.Flush()
return
}
```
#### Expected behavior
If there are no results, `HasNext()` should return `false` and the handler
should proceed.
#### Actual behavior
Hangs forever.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]