MCPcopy
hub / github.com/pocketbase/pocketbase / newPool

Function newPool

plugins/jsvm/pool.go:22–34  ·  view source on GitHub ↗

newPool creates a new pool with pre-warmed vms generated from the specified factory.

(size int, factory func() *goja.Runtime)

Source from the content-addressed store, hash-verified

20
21// newPool creates a new pool with pre-warmed vms generated from the specified factory.
22func newPool(size int, factory func() *goja.Runtime) *vmsPool {
23 pool := &vmsPool{
24 factory: factory,
25 items: make([]*poolItem, size),
26 }
27
28 for i := 0; i < size; i++ {
29 vm := pool.factory()
30 pool.items[i] = &poolItem{vm: vm}
31 }
32
33 return pool
34}
35
36// run executes "call" with a vm created from the pool
37// (either from the buffer or a new one if all buffered vms are busy)

Callers 5

TestCronBindsCountFunction · 0.85
TestHooksBindsFunction · 0.85
TestRouterBindsFunction · 0.85
registerHooksMethod · 0.85

Calls

no outgoing calls

Tested by 4

TestCronBindsCountFunction · 0.68
TestHooksBindsFunction · 0.68
TestRouterBindsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…