MaoMengww opened a new pull request, #3682: URL: https://github.com/apache/dubbo-go/pull/3682
### Description - Add doc comments to the ScriptRouter lifecycle methods (Process, Route, Notify, ...) describing the script instance lifecycle, reuse (reference-counting) behavior, and failure handling - Add doc comments to ScriptInstances, jsInstances, program, and the instance pool - Add unit tests covering: instance creation failure, script execution failure, instance reuse, and concurrent instance fetching #### Worth mentioning: - This PR also fixes a potential nil-pointer panic: in router.go lines 120 and 124, *cfg.Enabled was dereferenced unconditionally. Since RouterConfig is populated by YAML decoding and Enabled has no default value, omitting the field in the rule would crash the router. The dereference is now guarded, dafault true, and a regression test has been added. - The goja runtime pooling in this file is only half-implemented: insPool *sync.Pool (intended to store *goja.Runtime) only has Get calls but no Put, so every compilation creates a new runtime, degrading performance. if the maintainers agree — I'll open a separate issue for it and fix it. Refs https://github.com/apache/dubbo-go/issues/3644 (task11) ### Checklist - [x] I confirm the target branch is `develop` - [x] I have run `make fmt` to format my code - [x] I have run `make test` to run local tests - [x] I have added tests that prove my fix is effective or that my feature works -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
