Skip to content

Commit

Permalink
Merge pull request #1 from madflojo/negative_poolsize
Browse files Browse the repository at this point in the history
Handle Negative Pool Sizes
  • Loading branch information
madflojo authored Jan 4, 2024
2 parents a81a408 + 7f73fb8 commit 61c4d41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions engine/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ func (s *Server) LoadModule(cfg ModuleConfig) error {
m.ctx, m.cancel = context.WithCancel(context.Background())

// Set Pool Size
m.poolSize = uint64(cfg.PoolSize)
if cfg.PoolSize == 0 {
m.poolSize = uint64(DefaultPoolSize)
m.poolSize = uint64(DefaultPoolSize)
if cfg.PoolSize > 0 {
m.poolSize = uint64(cfg.PoolSize)
}

// Read the WASM module file
Expand Down
11 changes: 11 additions & 0 deletions engine/wasm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ func TestWASMModuleCreation(t *testing.T) {
},
})

// Negative Pool Size
mc = append(mc, ModuleCase{
Name: "Negative Pool Size",
Pass: true,
ModuleConf: ModuleConfig{
Name: "A Module",
PoolSize: -1,
Filepath: "../testdata/hello-go/hello.wasm",
},
})

// No File
mc = append(mc, ModuleCase{
Name: "No File",
Expand Down

0 comments on commit 61c4d41

Please sign in to comment.