Hi,
I have a workflow that can be simplified as follows.
func QueryWorkflow(ctx workflow.Context) error {
queryResult := "started"
logger := workflow.GetLogger(ctx)
logger.Info("QueryWorkflow started")
// setup query handler for query type "state"
err := workflow.SetQueryHandler(ctx, "state", func(input []byte) (string, error) {
return queryResult, nil
})
if err != nil {
logger.Info("SetQueryHandler failed: " + err.Error())
return err
}
queryResult = "something"
// to simulate workflow been blocked on something, in reality, workflow could wait on anything like activity, signal or timer
for {
selector := workflow.NewSelector(ctx)
selector.AddReceive(someChannel, func(c workflow.ReceiveChannel, _ bool) {
// update queryResult
// check other logic whether shouldStop
})
selector.Select(ctx)
if shouldStop {
break
}
}
return nil
}
When I query the status of the variable, I often get a timeout at 10s.
I have done some searching but cannot find any relevant answer.
Can anybody help me shed some light on this, please? Thanks a lot.