Skip to content

Commit

Permalink
fixup! fix(core/modules): Fix concurrent loading of dynamic imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn committed Jun 26, 2021
1 parent 015c8f4 commit a359541
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub extern "C" fn host_import_module_dynamically_callback(
specifier_str, referrer_name_str
);
ModuleMap::load_dynamic_import(
module_map_rc.clone(),
module_map_rc,
&specifier_str,
&referrer_name_str,
resolver_handle,
Expand Down
15 changes: 6 additions & 9 deletions core/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,13 @@ impl RecursiveModuleLoad {
pending: FuturesUnordered::new(),
visited: HashSet::new(),
};
match load.resolve_root() {
Ok(root_specifier) => {
if let Some(module_id) =
module_map_rc.borrow().get_id(root_specifier.as_str())
{
load.root_module_id = Some(module_id);
}
// Ignore the error here, let it be hit in `Stream::poll_next()`.
if let Ok(root_specifier) = load.resolve_root() {
if let Some(module_id) =
module_map_rc.borrow().get_id(root_specifier.as_str())
{
load.root_module_id = Some(module_id);
}
// Ignore the error here, let it be hit in `Stream::poll_next()`.
Err(_) => {}
}
load
}
Expand Down

0 comments on commit a359541

Please sign in to comment.