fix: tables.bas only if changed, clean drive monitor logs
All checks were successful
BotServer CI/CD / build (push) Successful in 5m39s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-17 10:48:35 -03:00
parent eb0aba0a9a
commit 7f265bf205
2 changed files with 37 additions and 11 deletions

View file

@ -116,9 +116,34 @@ impl BasicCompiler {
let source_content = fs::read_to_string(source_path)
.map_err(|e| format!("Failed to read source file: {e}"))?;
// Also process tables.bas to ensure tables are created
if let Err(e) = Self::process_tables_bas(&self.state, self.bot_id) {
log::warn!("Failed to process tables.bas: {}", e);
// Check if tables.bas has changed by comparing .bas vs .ast modification time
// Only process if .bas is newer than .ast or .ast doesn't exist
let should_process_tables = if source_path.contains("tables.bas") {
let work_path = crate::core::shared::utils::get_work_path();
let bot_name = Self::get_bot_name_from_state(&self.state, self.bot_id)?;
let tables_bas_path = format!(
"{}/{}.gbai/{}.gbdialog/tables.bas",
work_path, bot_name, bot_name
);
let tables_ast_path = tables_bas_path.replace(".bas", ".ast");
match (
std::fs::metadata(&tables_bas_path).ok(),
std::fs::metadata(&tables_ast_path).ok(),
) {
(Some(bas_meta), Some(ast_meta)) => {
bas_meta.modified().ok() > ast_meta.modified().ok()
}
_ => true,
}
} else {
true
};
if should_process_tables {
if let Err(e) = Self::process_tables_bas(&self.state, self.bot_id) {
log::warn!("Failed to process tables.bas: {}", e);
}
}
if let Err(e) =

View file

@ -437,6 +437,7 @@ match result {
}
self.is_processing.store(true, Ordering::Release);
trace!("DriveMonitor checking {}", self.bucket_name);
match self.check_for_changes().await {
Ok(_) => {
@ -463,14 +464,14 @@ match result {
};
// All checks run independently - one failure doesn't stop others
if let Err(e) = self.check_gbdialog_changes(client).await {
error!("gbdialog check failed: {}", e);
}
if let Err(e) = self.check_gbot(client).await {
error!("gbot check failed: {}", e);
}
if let Err(e) = self.check_gbkb_changes(client).await {
error!("gbkb check failed: {}", e);
let gbdialog_err = self.check_gbdialog_changes(client).await.err();
let gbot_err = self.check_gbot(client).await.err();
let gbkb_err = self.check_gbkb_changes(client).await.err();
if gbdialog_err.is_some() || gbot_err.is_some() || gbkb_err.is_some() {
error!("Drive changes: gbdialog={:?}, gbot={:?}, gbkb={:?}", gbdialog_err, gbot_err, gbkb_err);
} else {
trace!("DriveMonitor: 0 changes for {}", self.bucket_name);
}
Ok(())