fix: process lagged compile reason (#456)

This commit is contained in:
Myriad-Dreamin 2024-07-25 12:09:17 +08:00 committed by GitHub
parent 7b8b3938a2
commit d9767a63f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View file

@ -651,16 +651,17 @@ impl<F: CompilerFeat + Send + Sync + 'static> CompileServerActor<F> {
.status(self.verse.revision.get_mut().get(), CompileReport::Suspend);
}
// Reset the document state.
// Reset the watch state and document state.
self.latest_doc = None;
self.latest_success_doc = None;
self.suspended_reason = no_reason();
}
reason_by_entry_change()
}
Interrupt::Compiled(artifact) => {
self.process_compile(artifact, send);
no_reason()
self.process_lagged_compile()
}
Interrupt::Memory(event) => {
log::debug!("CompileServerActor: memory event incoming");
@ -725,6 +726,12 @@ impl<F: CompilerFeat + Send + Sync + 'static> CompileServerActor<F> {
}
}
/// Process reason after each compilation.
fn process_lagged_compile(&mut self) -> CompileReasons {
// The reason which is kept but not used.
std::mem::take(&mut self.suspended_reason)
}
/// Apply delayed memory changes to underlying compiler.
fn apply_delayed_memory_changes(
verse: &mut Revising<CompilerUniverse<F>>,
@ -764,11 +771,7 @@ impl<F: CompilerFeat + Send + Sync + 'static> CompileServerActor<F> {
let insert_file = match t.content().cloned() {
Ok(content) => content,
Err(err) => {
log::error!(
"CompileServerActor: read memory file at {}: {}",
p.display(),
err,
);
log::error!("CompileServerActor: read memory file at {p:?}: {err}");
continue;
}
};

View file

@ -131,7 +131,7 @@ impl RenderActor {
// if a full render is requested, we render the latest document
// otherwise, we render the incremental changes for only once
let has_full_render = has_full_render;
debug!("RenderActor: has_full_render: {}", has_full_render);
debug!("RenderActor: has_full_render: {has_full_render}");
let Some(document) = self.document.read().unwrap().clone() else {
info!("RenderActor: document is not ready");
continue;