Hello, I expected that when calling RunWithContext the execution time would be limited to five seconds, but in fact the code runs for more than two minutes.
Is this expected behavior? Is there anything I can do to accurately limit the execution time?
Version: github.com/itchyny/gojq v0.12.19
Code:
package main
import (
"github.com/itchyny/gojq"
"context"
"time"
)
func main() {
parsed, err := gojq.Parse("capture(\"^\"*78888880)")
if err != nil {
panic(err)
}
code, err := gojq.Compile(parsed)
if err != nil {
panic(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
iter := code.RunWithContext(ctx, "hello")
_, _ = iter.Next()
}
Hello, I expected that when calling RunWithContext the execution time would be limited to five seconds, but in fact the code runs for more than two minutes.
Is this expected behavior? Is there anything I can do to accurately limit the execution time?
Version: github.com/itchyny/gojq v0.12.19
Code: