fix: prevent VLM panic by using try_read instead of blocking_read
** Problem: - get_face_filter_defaults() used blocking_read() in sync context - Caused panic: 'Cannot block the current thread from within a runtime' - VLM generation repeatedly failed with panic ** Root Cause: - admin_config.rs:473: ADMIN_CONFIG.config.blocking_read() - Called from FileProfile::defaults() which runs in async context - Tokio runtime doesn't allow blocking operations ** Fix: - Replace blocking_read() with try_read() - Fall back to hardcoded defaults if config is locked - Non-blocking, safe for async context ** Impact: - VLM summaries now generate successfully - No more panics in VLM processing - Job 779 VLM generation now working
This commit is contained in:
@@ -468,15 +468,25 @@ pub async fn get_filter_config(key: &str) -> Option<FilterConfig> {
|
||||
/// Synchronous version for getting face filter defaults
|
||||
/// Used in synchronous contexts like FileProfile::defaults()
|
||||
pub fn get_face_filter_defaults() -> (f64, i32, f64) {
|
||||
// Use blocking_read for sync context
|
||||
// Returns (min_confidence, min_size, min_capture_quality)
|
||||
let config = ADMIN_CONFIG.config.blocking_read();
|
||||
// Try to read without blocking - use try_read for non-blocking access
|
||||
// If config is locked, fall back to hardcoded defaults
|
||||
let config = ADMIN_CONFIG.config.try_read();
|
||||
|
||||
(
|
||||
config.face_filter_defaults.min_confidence,
|
||||
config.face_filter_defaults.min_size,
|
||||
config.face_filter_defaults.min_capture_quality,
|
||||
)
|
||||
match config {
|
||||
Ok(cfg) => (
|
||||
cfg.face_filter_defaults.min_confidence,
|
||||
cfg.face_filter_defaults.min_size,
|
||||
cfg.face_filter_defaults.min_capture_quality,
|
||||
),
|
||||
Err(_) => {
|
||||
// Config locked, use hardcoded defaults
|
||||
(
|
||||
crate::core::config::FACE_MIN_CONFIDENCE_DEFAULT,
|
||||
crate::core::config::FACE_MIN_SIZE_DEFAULT,
|
||||
0.25, // min_capture_quality default
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_paths() -> PathsConfig {
|
||||
|
||||
Reference in New Issue
Block a user