Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/compiler/non-pool.go
2070 views
1
package compiler
2
3
import (
4
"sync"
5
6
"github.com/Mzack9999/goja"
7
syncutil "github.com/projectdiscovery/utils/sync"
8
)
9
10
var (
11
ephemeraljsc *syncutil.AdaptiveWaitGroup
12
lazyFixedSgInit = sync.OnceFunc(func() {
13
ephemeraljsc, _ = syncutil.New(syncutil.WithSize(NonPoolingVMConcurrency))
14
})
15
)
16
17
func executeWithoutPooling(p *goja.Program, args *ExecuteArgs, opts *ExecuteOptions) (result goja.Value, err error) {
18
lazyFixedSgInit()
19
ephemeraljsc.Add()
20
defer ephemeraljsc.Done()
21
runtime := createNewRuntime()
22
return executeWithRuntime(runtime, p, args, opts)
23
}
24
25