1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

refactor: rename run_basic to run_local (#15068)

This commit is contained in:
cuobiezi 2022-07-12 01:02:23 +08:00 committed by GitHub
parent 12df9f3679
commit 83818c914b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 14 deletions

View file

@ -9,7 +9,7 @@ use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use deno_core::ModuleSpecifier;
use deno_graph::ModuleKind;
use deno_runtime::tokio_util::run_basic;
use deno_runtime::tokio_util::run_local;
use import_map::ImportMap;
use log::error;
use log::warn;
@ -2822,7 +2822,7 @@ impl Inner {
// todo(dsherret): why is running this on a new thread necessary? It does
// a compile error otherwise.
let handle = tokio::task::spawn_blocking(|| {
run_basic(
run_local(
async move { create_graph_for_caching(cli_options, roots).await },
)
});

View file

@ -31,7 +31,7 @@ use deno_core::ModuleSpecifier;
use deno_runtime::ops::io::Stdio;
use deno_runtime::ops::io::StdioPipe;
use deno_runtime::permissions::Permissions;
use deno_runtime::tokio_util::run_basic;
use deno_runtime::tokio_util::run_local;
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
@ -353,7 +353,7 @@ impl TestRun {
tokio::task::spawn_blocking(move || {
let origin = specifier.to_string();
let file_result = run_basic(test_specifier(
let file_result = run_local(test_specifier(
ps,
permissions,
specifier,

View file

@ -90,7 +90,7 @@ use deno_runtime::colors;
use deno_runtime::ops::worker_host::CreateWebWorkerCb;
use deno_runtime::ops::worker_host::PreloadModuleCb;
use deno_runtime::permissions::Permissions;
use deno_runtime::tokio_util::run_basic;
use deno_runtime::tokio_util::run_local;
use deno_runtime::web_worker::WebWorker;
use deno_runtime::web_worker::WebWorkerOptions;
use deno_runtime::worker::MainWorker;
@ -1392,7 +1392,7 @@ pub fn main() {
exit_code
};
let exit_code = unwrap_or_exit(run_basic(exit_code));
let exit_code = unwrap_or_exit(run_local(exit_code));
std::process::exit(exit_code);
}

View file

@ -28,7 +28,7 @@ use deno_core::futures::StreamExt;
use deno_core::ModuleSpecifier;
use deno_graph::ModuleKind;
use deno_runtime::permissions::Permissions;
use deno_runtime::tokio_util::run_basic;
use deno_runtime::tokio_util::run_local;
use indexmap::IndexMap;
use log::Level;
use serde::Deserialize;
@ -434,7 +434,7 @@ async fn bench_specifiers(
tokio::task::spawn_blocking(move || {
let future = bench_specifier(ps, permissions, specifier, sender, options);
run_basic(future)
run_local(future)
})
});

View file

@ -39,7 +39,7 @@ use deno_graph::ModuleKind;
use deno_runtime::ops::io::Stdio;
use deno_runtime::ops::io::StdioPipe;
use deno_runtime::permissions::Permissions;
use deno_runtime::tokio_util::run_basic;
use deno_runtime::tokio_util::run_local;
use log::Level;
use rand::rngs::SmallRng;
use rand::seq::SliceRandom;
@ -1118,7 +1118,7 @@ async fn test_specifiers(
tokio::task::spawn_blocking(move || {
let origin = specifier.to_string();
let file_result = run_basic(test_specifier(
let file_result = run_local(test_specifier(
ps,
permissions,
specifier,

View file

@ -14,8 +14,7 @@ pub fn create_basic_runtime() -> tokio::runtime::Runtime {
.unwrap()
}
// TODO(ry) rename to run_local ?
pub fn run_basic<F, R>(future: F) -> R
pub fn run_local<F, R>(future: F) -> R
where
F: std::future::Future<Output = R>,
{

View file

@ -5,7 +5,7 @@ use crate::js;
use crate::ops;
use crate::ops::io::Stdio;
use crate::permissions::Permissions;
use crate::tokio_util::run_basic;
use crate::tokio_util::run_local;
use crate::worker::FormatJsErrorFn;
use crate::BootstrapOptions;
use deno_broadcast_channel::InMemoryBroadcastChannel;
@ -733,5 +733,5 @@ pub fn run_web_worker(
debug!("Worker thread shuts down {}", &name);
result
};
run_basic(fut)
run_local(fut)
}