Skip to content

feat(runtime): experimental: load functions in a separate process #147

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

Merged
merged 4 commits into from
Jul 6, 2020

Conversation

philnash
Copy link
Contributor

…after callback

WIP for #135

This work replaces functionToRoute code that picks a function, creates the context and environment for it, runs it and responds to the express application with functionPathToRoute that forks a child process to do the above, killing the process once the callback is called.

Currently this works and will run and serve functions successfully in local development mode.

Current issues:

  • The integration tests don't pass. As far as I can see, it is because the tests are trying to load the functionRunner from the TS directory and not the built JS project
  • Functions are loaded fresh every time, because they are loaded into a new process. This is a breaking change and invalidates the --live flag (as it is always live). This is a potential performance issue.
  • I've left some old code lying around, including:
    • setting the twilio client on the context (this is done in the forked process now)
    • the old functionToRoute method that was being used to run the function

I'd appreciate a look over what's been done so far and any opinions. I was surprised I managed this over the course of a stream, so I'm sure there are some very rough parts.

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

@philnash philnash marked this pull request as ready for review July 6, 2020 00:18
@philnash philnash requested a review from dkundel July 6, 2020 02:25
@dkundel dkundel changed the title feat(runtime): loads functions in a separate process and kills them feat(runtime): experimental: load functions in a separate process Jul 6, 2020
@dkundel dkundel merged commit 0a4f542 into twilio-labs:master Jul 6, 2020
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.

2 participants