-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(runtime,serverless,cli): parallel requests to the same isola…
…te (#676) * refactor(runtime,serverless,cli): parallel requests * refactor: clean unused code * refactor(cli,wpt-runner): update to new runtime * fix: memory limit termination * fix: remove thread_ids & add observability * feat: timeout * feat: terminate isolates * feat: disable cronjob * chore: clean comments * fix: pub sub cache * fix: per-request context * fix: clean * feat: add statistics * chore: add changeset * fix: missing import in release mode * feat: optimize
- Loading branch information
Showing
37 changed files
with
1,827 additions
and
1,779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@lagon/cli': patch | ||
'@lagon/runtime': patch | ||
'@lagon/serverless': patch | ||
--- | ||
|
||
Allow parallel requests to the same isolate |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,46 @@ | ||
use lagon_runtime_http::{Request, Response, RunResult}; | ||
use lagon_runtime_isolate::{options::IsolateOptions, Isolate}; | ||
use lagon_runtime_isolate::options::IsolateOptions; | ||
|
||
mod utils; | ||
|
||
#[tokio::test] | ||
async fn allow_eval() { | ||
utils::setup_allow_codegen(); | ||
let mut isolate = Isolate::new(IsolateOptions::new( | ||
"export function handler() { | ||
const result = eval('1 + 1') | ||
return new Response(result) | ||
let (mut isolate, send, receiver) = | ||
utils::create_isolate_without_snapshot(IsolateOptions::new( | ||
"export function handler() { | ||
const result = eval('1 + 1') | ||
return new Response(result) | ||
}" | ||
.into(), | ||
)); | ||
let (tx, rx) = flume::unbounded(); | ||
isolate.run(Request::default(), tx).await; | ||
.into(), | ||
)); | ||
send(Request::default()); | ||
|
||
assert_eq!( | ||
rx.recv_async().await.unwrap(), | ||
RunResult::Response(Response::from("2")) | ||
); | ||
tokio::select! { | ||
_ = isolate.run_event_loop() => {} | ||
result = receiver.recv_async() => { | ||
assert_eq!(result.unwrap(), RunResult::Response(Response::from("2"))); | ||
} | ||
} | ||
} | ||
|
||
#[tokio::test] | ||
async fn allow_function() { | ||
utils::setup_allow_codegen(); | ||
let mut isolate = Isolate::new(IsolateOptions::new( | ||
"export function handler() { | ||
let (mut isolate, send, receiver) = | ||
utils::create_isolate_without_snapshot(IsolateOptions::new( | ||
"export function handler() { | ||
const result = new Function('return 1 + 1') | ||
return new Response(result()) | ||
}" | ||
.into(), | ||
)); | ||
let (tx, rx) = flume::unbounded(); | ||
isolate.run(Request::default(), tx).await; | ||
.into(), | ||
)); | ||
send(Request::default()); | ||
|
||
assert_eq!( | ||
rx.recv_async().await.unwrap(), | ||
RunResult::Response(Response::from("2")) | ||
); | ||
tokio::select! { | ||
_ = isolate.run_event_loop() => {} | ||
result = receiver.recv_async() => { | ||
assert_eq!(result.unwrap(), RunResult::Response(Response::from("2"))); | ||
} | ||
} | ||
} |
Oops, something went wrong.
54e37e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
storybook – ./packages/ui
storybook-lagon.vercel.app
storybook-git-main-lagon.vercel.app
storybook-swart-eight.vercel.app
ui.lagon.app
54e37e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./packages/docs
docs-lagon.vercel.app
lagon-docs.vercel.app
docs-git-main-lagon.vercel.app
docs.lagon.app
54e37e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dashboard – ./packages/dashboard
dashboard-lagon.vercel.app
dashboard-git-main-lagon.vercel.app
dash.lagon.app
54e37e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
www – ./www
www-lagon.vercel.app
lagon.app
www-git-main-lagon.vercel.app
lagon.dev