Commit 5571d9bc authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Correctly list JavaScript modules loaded from the default entrypoint.

parent 19d28274
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Build with Go 1.17.0 release.
- New config option to toggle Lua runtime error stacktraces returned to clients.
- Purchase validation functions now return a flag indicating if valid purchases are new or resubmitted.
- Adjust Lua runtime pool allocation startup logs.

### Fixed
- Fix log level in Lua runtime log calls which use logger fields.
@@ -29,6 +30,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Fix typos in error messages referencing empty input values.
- Fix scale of exported time and latency metrics.
- Fix Lua groupUpdate function incorrect parsing of 'open' argument.
- Correctly list JavaScript modules loaded from the default entrypoint.

## [3.5.0] - 2021-08-10
### Added
+6 −1
Original line number Diff line number Diff line
@@ -1616,7 +1616,12 @@ func cacheJavascriptModules(logger *zap.Logger, path, entrypoint string) (*Runti
		return nil, err
	}

	modName := filepath.Base(entrypoint)
	var modName string
	if entrypoint == "" {
		modName = filepath.Base(JsEntrypointFilename)
	} else {
		modName = filepath.Base(entrypoint)
	}
	ast, _ := goja.Parse(modName, string(content))
	prg, err := goja.Compile(modName, string(content), true)
	if err != nil {
+2 −2
Original line number Diff line number Diff line
@@ -1116,7 +1116,7 @@ func NewRuntimeProviderLua(logger, startupLogger *zap.Logger, db *sql.DB, protoj
	startupLogger.Info("Lua runtime modules loaded")

	// Warm up the pool.
	startupLogger.Info("Allocating minimum runtime pool", zap.Int("count", config.GetRuntime().GetLuaMinCount()))
	startupLogger.Info("Allocating minimum Lua runtime pool", zap.Int("count", config.GetRuntime().GetLuaMinCount()))
	if len(moduleCache.Names) > 0 {
		// Only if there are runtime modules to load.
		for i := 0; i < config.GetRuntime().GetLuaMinCount(); i++ {
@@ -1124,7 +1124,7 @@ func NewRuntimeProviderLua(logger, startupLogger *zap.Logger, db *sql.DB, protoj
		}
		runtimeProviderLua.metrics.GaugeLuaRuntimes(float64(config.GetRuntime().GetLuaMinCount()))
	}
	startupLogger.Info("Allocated minimum runtime pool")
	startupLogger.Info("Allocated minimum Lua runtime pool")

	return modulePaths, rpcFunctions, beforeRtFunctions, afterRtFunctions, beforeReqFunctions, afterReqFunctions, matchmakerMatchedFunction, tournamentEndFunction, tournamentResetFunction, leaderboardResetFunction, nil
}