Skip to content

Commit cd82410

Browse files
committed
refactor(feeds): clone app_config to avoid borrow issues
The changes clone app_config instances when reading from shared context to prevent potential borrow checker issues and improve thread safety. This pattern is now consistently applied across multiple methods in the feeds update and LLM feature implementations.
1 parent da99abc commit cd82410

File tree

3 files changed

+645
-542
lines changed

3 files changed

+645
-542
lines changed

app/src-tauri/src/daemon/feeds_update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async fn schedule_loop<R: Runtime>(
3636
state: Arc<HybridRuntimeState>,
3737
) -> anyhow::Result<()> {
3838
let features = &state.features_api;
39-
let app_config = &features.context.read().await.app_config;
39+
let app_config = { features.context.read().await.app_config.clone() };
4040
// 在所有权转移前读取需要的配置
4141
let update_interval = Duration::from_secs(match &app_config.daemon.frequency_feeds_update {
4242
true => 60 * 60 * 1,

0 commit comments

Comments
 (0)