8000 Allow builtin modules replacement in compiled scripts by DenKoren · Pull Request #454 · d5/tengo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow builtin modules replacement in compiled scripts #454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DenKoren
Copy link

Motivation:

Compiled scripts can be executed concurrently out of the box.
At the same time, custom builtin modules can be passed to tengo script out from go, providing additional functionalities to the script.

If such builtin module is not designed for concurrent use, it becomes a limitation for the compiled tengo script. In most cases it is possible to 'rule out' concurrency use limitation on module's side, but in most cases this is 'fixed' by new lock introductions, which makes parallel tengo compiled scripts execution to block on single instance of builtin module during runtime.

For now, the only way to overcome this issue is to re-compile template for each instance of builtin module, which 8000 works well but leads to code overcomplication: it becomes necessary to manage compiled script pools in order to execute each script instance solely single-threaded because it is strictly bound to single builtin module instance.

This feature allows to hot-swap builtin module instance inside compiled script making it possible to execute several clones (.Clone()) in parallel, each using its own instance of builtin module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0