fix: properly track compilation status in DriveMonitor
All checks were successful
BotServer CI/CD / build (push) Successful in 3m15s
All checks were successful
BotServer CI/CD / build (push) Successful in 3m15s
- Do not mark .bas files as indexed unconditionally - Only set indexed=true when compile_tool() completes successfully - Reset fail_count and last_failed_at on successful compilation - Retry failed compilations automatically on next cycle - Fixes permanent compilation failure state for salesianos start.bas
This commit is contained in:
parent
9de9bc983b
commit
7c4ec37700
1 changed files with 17 additions and 4 deletions
|
|
@ -567,15 +567,19 @@ impl DriveMonitor {
|
||||||
}
|
}
|
||||||
for (path, new_state) in current_files {
|
for (path, new_state) in current_files {
|
||||||
let mut state = new_state;
|
let mut state = new_state;
|
||||||
if path.ends_with(".bas") {
|
let is_bas_file = path.ends_with(".bas");
|
||||||
state.indexed = true;
|
|
||||||
}
|
// Only mark as indexed if file was actually compiled successfully
|
||||||
|
// Default to false, will only be true if compilation completed without errors
|
||||||
|
state.indexed = false;
|
||||||
|
|
||||||
// Preserve fail_count and last_failed_at for existing files that weren't modified
|
// Preserve fail_count and last_failed_at for existing files that weren't modified
|
||||||
if let Some(prev_state) = file_states.get(&path) {
|
if let Some(prev_state) = file_states.get(&path) {
|
||||||
if prev_state.etag == state.etag {
|
if prev_state.etag == state.etag {
|
||||||
// File wasn't modified - preserve fail_count and last_failed_at
|
// File wasn't modified - preserve fail_count, last_failed_at AND indexed status
|
||||||
state.fail_count = prev_state.fail_count;
|
state.fail_count = prev_state.fail_count;
|
||||||
state.last_failed_at = prev_state.last_failed_at;
|
state.last_failed_at = prev_state.last_failed_at;
|
||||||
|
state.indexed = prev_state.indexed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_states.insert(path, state);
|
file_states.insert(path, state);
|
||||||
|
|
@ -1021,6 +1025,15 @@ impl DriveMonitor {
|
||||||
|
|
||||||
info!("Successfully compiled {} in {} ms", tool_name, elapsed_ms);
|
info!("Successfully compiled {} in {} ms", tool_name, elapsed_ms);
|
||||||
|
|
||||||
|
// Mark file as successfully indexed
|
||||||
|
let mut file_states = self.file_states.write().await;
|
||||||
|
if let Some(state) = file_states.get_mut(file_path) {
|
||||||
|
state.indexed = true;
|
||||||
|
state.fail_count = 0;
|
||||||
|
state.last_failed_at = None;
|
||||||
|
}
|
||||||
|
drop(file_states);
|
||||||
|
|
||||||
// Check for USE WEBSITE commands and trigger immediate crawling
|
// Check for USE WEBSITE commands and trigger immediate crawling
|
||||||
if source_content.contains("USE WEBSITE") {
|
if source_content.contains("USE WEBSITE") {
|
||||||
self.trigger_immediate_website_crawl(&source_content).await?;
|
self.trigger_immediate_website_crawl(&source_content).await?;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue