Skip to content
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

Goja JSVM for Gateway #1961

Closed
wants to merge 10 commits into from
Closed

Goja JSVM for Gateway #1961

wants to merge 10 commits into from

Conversation

joshblakeley
Copy link
Member

@joshblakeley joshblakeley commented Nov 2, 2018

For #1893

This PR introduces a new JSVM that can be used in Tyk.

In gateway config value is enable_v2_jsvm

@joshblakeley joshblakeley changed the title WIP Gateway uses configurable JSVM driver Goja JSVM for Gateway Nov 5, 2018
@joshblakeley
Copy link
Member Author

@matiasinsaurralde would appreciate you looking over the plugin side of things - test all pass locally but are a bit flaky on ci still

@matiasinsaurralde
Copy link
Contributor

Looks like a vendoring issue to me, related to golang.org/x/text/language.

@joshblakeley
Copy link
Member Author

Yep i just broke it now when vendoring - it was a different issue before related to a timeout or hang. I'll fix vendoring then ping you again 👍

@matiasinsaurralde
Copy link
Contributor

We should also check the latest otto changes, I've updated the vendored version in my local branch and seems there's some new stuff, mostly bugfixes:

diff --git a/vendor/vendor.json b/vendor/vendor.json
index 9f5b84a5..d8bdd32c 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -437,10 +437,10 @@
                {
-                       "checksumSHA1": "ZSYig6eYkc34ELHl6O5gRtJvr6o=",
+                       "checksumSHA1": "WdorbyEJiNbjIOiQzM4TLb/XA7Q=",
                        "path": "github.com/robertkrimen/otto",
-                       "revision": "fc2eb1bbf1c5c462313c810bb02dc93cd964aebe",
-                       "revisionTime": "2017-07-21T19:43:36Z"
+                       "revision": "15f95af6e78dcd2030d8195a138bd88d4f403546",
+                       "revisionTime": "2018-06-17T13:11:54Z"
                },

@joshblakeley
Copy link
Member Author

@matiasinsaurralde PTAL

@matiasinsaurralde
Copy link
Contributor

Looks good, seems the timeout issue is fixed now!

main.go Outdated
@@ -466,13 +466,17 @@ func loadCustomMiddleware(spec *APISpec) ([]string, apidef.MiddlewareDefinition,
mwPreFuncs := []apidef.MiddlewareDefinition{}
mwPostFuncs := []apidef.MiddlewareDefinition{}
mwPostKeyAuthFuncs := []apidef.MiddlewareDefinition{}
mwDriver := apidef.OttoDriver

var mwDriver apidef.MiddlewareDriver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could default to otto here and simplify the if block:

mwDriver := apidef.OttoDriver
if config.Global().JSVM == "goja" {
  mwDriver = apidef.GojaDriver
}

@buger
Copy link
Member

buger commented Nov 30, 2018

I wonder if we can refactor it a bit, since jsvm_goja.go and jsvm_otto.go contains almost idential code.

@joshblakeley
Copy link
Member Author

I'll see where I can squeeze it down

@stale
Copy link

stale bot commented Mar 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, please add comments to this ticket if you would like it to stay open. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 25, 2020
@stale stale bot closed this Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants