Damian Reeves
Damian Reeves
DDeno
Created by Damian Reeves on 6/13/2024 in #help
Creating custom ops for deno_core that take in arrays and strucks
Any chance of getting a human response?
3 replies
DDeno
Created by Damian Reeves on 6/4/2024 in #help
Using Deno core in an app that already had its own tokio runtime
Interesting, let me see if I can change my app to use current_thread, yet still make a dedicated thread for the deno work from my main app
12 replies
DDeno
Created by Damian Reeves on 6/4/2024 in #help
Using Deno core in an app that already had its own tokio runtime
I found that when I tried to use a Handle to call sync code such as the setTimeout from the repo that my code exited with a panic. I’d love to not use another Tokyo runtime and instead have a dedicated pool for my workloads that use deno_core but I’m not familiar enough with either tokio or eeno to accomplish this
12 replies
DDeno
Created by Damian Reeves on 6/4/2024 in #help
Using Deno core in an app that already had its own tokio runtime
So after hacking around a bit, this seems to work.
pub(crate) fn run_js(args: &RunArgs) {
let file = args.file.to_owned();
std::thread::spawn(move || {
let file_path = file.to_str();
file_path.map(|path| {
println!("Running JavaScript file: {}", path);

let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();

if let Err(error) = runtime.block_on(run_js(path)) {
eprintln!("error: {error}");
}
});
})
.join()
.unwrap();
}
pub(crate) fn run_js(args: &RunArgs) {
let file = args.file.to_owned();
std::thread::spawn(move || {
let file_path = file.to_str();
file_path.map(|path| {
println!("Running JavaScript file: {}", path);

let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();

if let Err(error) = runtime.block_on(run_js(path)) {
eprintln!("error: {error}");
}
});
})
.join()
.unwrap();
}
I changed args.file to an Arc<OsString> instead of an OsString.
12 replies
DDeno
Created by Damian Reeves on 6/4/2024 in #help
Using Deno core in an app that already had its own tokio runtime
Can any guidance be guided on how to run deno in its own pool for an app that already has an existing tokio runtime?
12 replies