mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-15 02:25:17 +00:00
aep export: note what the concurrency test covers and why a failed template build is not kept (#3277)
This commit is contained in:
@@ -930,8 +930,10 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// Exports running at the same time on several threads, the first of them possibly building
|
||||
/// the shared template, all give the single-threaded bytes.
|
||||
/// Exports running at the same time on several threads all give the single-threaded bytes.
|
||||
/// This checks concurrent exports from a template that is already built: other tests in this
|
||||
/// binary usually fill the shared template first, so the race on the first build is not
|
||||
/// reliably exercised here (the `static OnceLock` makes that race safe by construction).
|
||||
#[test]
|
||||
fn concurrent_exports_give_the_same_bytes() {
|
||||
let plans: Vec<ProjectPlan> = ["", " x", " y", " z"].iter().map(|t| plan_of(&varied(t))).collect();
|
||||
|
||||
@@ -94,6 +94,7 @@ pub(crate) fn shared() -> R<&'static Template> {
|
||||
if let Some(t) = SHARED.get() {
|
||||
return Ok(t);
|
||||
}
|
||||
// A failed build returns here, before `get_or_init`, so it is never kept.
|
||||
let t = Template::load()?;
|
||||
Ok(SHARED.get_or_init(|| t))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user