Fixes race on engine creation with Cache API (#1021)

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda
2023-01-11 09:46:55 +09:00
committed by GitHub
parent 3fc5392570
commit e216466331
6 changed files with 44 additions and 12 deletions

View File

@@ -125,13 +125,15 @@ func NewRuntimeConfig() RuntimeConfig {
return newRuntimeConfig()
}
type newEngine func(context.Context, api.CoreFeatures, filecache.Cache) wasm.Engine
type runtimeConfig struct {
enabledFeatures api.CoreFeatures
memoryLimitPages uint32
memoryCapacityFromMax bool
isInterpreter bool
dwarfDisabled bool // negative as defaults to enabled
newEngine func(context.Context, api.CoreFeatures, filecache.Cache) wasm.Engine
newEngine newEngine
cache CompilationCache
}