fix: DriveCompiler compilation errors
Some checks failed
BotServer CI/CD / build (push) Failing after 1s

- Fix Diesel query to use correct column types
- Remove non-existent drive::configure() call
- Clean up unused imports
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-18 15:04:09 -03:00
parent 1218d1b968
commit fd786cd7da
2 changed files with 46 additions and 46 deletions

View file

@ -11,9 +11,9 @@
use crate::basic::compiler::BasicCompiler;
use crate::core::shared::state::AppState;
use crate::core::shared::utils::get_work_path;
use crate::drive::drive_files::{drive_files as drive_files_table, DriveFileRepository};
use crate::drive::drive_files::drive_files as drive_files_table;
use diesel::prelude::*;
use log::{debug, error, info, warn};
use log::{debug, error, info};
use std::collections::HashMap;
use std::error::Error;
use std::path::PathBuf;
@ -76,30 +76,30 @@ impl DriveCompiler {
let files: Vec<(Uuid, String, String, Option<String>)> = drive_files_table
.filter(file_type.eq("bas"))
.filter(file_path.like("%.gbdialog/%"))
.select((bot_id, file_path, file_type, etag.clone()))
.select((bot_id, file_path, file_type, etag))
.load(&mut conn)?;
for (bot_id, file_path, _file_type, current_etag_opt) in files {
for (bot_id, file_path_str, _file_type, current_etag_opt) in files {
let current_etag = current_etag_opt.unwrap_or_default();
// Verificar se precisa compilar
let should_compile = {
let etags = self.last_etags.read().await;
etags.get(&file_path).map(|e| e != &current_etag).unwrap_or(true)
etags.get(&file_path_str).map(|e| e != &current_etag).unwrap_or(true)
};
if should_compile {
debug!("DriveCompiler: {} changed, compiling...", file_path);
debug!("DriveCompiler: {} changed, compiling...", file_path_str);
// Compilar diretamente para work dir
if let Err(e) = self.compile_file(bot_id, &file_path).await {
error!("Failed to compile {}: {}", file_path, e);
if let Err(e) = self.compile_file(bot_id, &file_path_str).await {
error!("Failed to compile {}: {}", file_path_str, e);
} else {
// Atualizar estado
let mut etags = self.last_etags.write().await;
etags.insert(file_path.clone(), current_etag.clone());
etags.insert(file_path_str.clone(), current_etag.clone());
info!("DriveCompiler: {} compiled successfully", file_path);
info!("DriveCompiler: {} compiled successfully", file_path_str);
}
}
}

View file

@ -176,7 +176,7 @@ pub async fn run_axum_server(
#[cfg(feature = "drive")]
{
api_router = api_router.merge(crate::drive::configure());
api_router = // drive routes are handled by DriveMonitor, no HTTP routes needed
}
#[cfg(feature = "directory")]