Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Dec 24, 2024
1 parent 452a6ab commit 2677aa0
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions services/appflowy-worker/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ pub async fn create_app(listener: TcpListener, config: Config) -> Result<(), Err
state.metrics.embedder_metrics.clone(),
threads.clone(),
BackgroundIndexerConfig {
enable: appflowy_collaborate::config::get_env_var("APPFLOWY_INDEXER_ENABLED", "true")
.parse::<bool>()
.unwrap_or(true),
open_api_key: appflowy_collaborate::config::get_env_var("APPFLOWY_AI_OPENAI_API_KEY", ""),
tick_interval_secs: 10,
},
Expand Down
7 changes: 7 additions & 0 deletions services/appflowy-worker/src/indexer_worker/worker.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use app_error::AppError;
use appflowy_collaborate::config::get_env_var;
use collab_entity::CollabType;
use database::index::get_collabs_indexed_at;
use indexer::collab_indexer::{Indexer, IndexerProvider};
Expand All @@ -25,6 +26,7 @@ use tracing::{error, info, trace};

#[derive(Debug)]
pub struct BackgroundIndexerConfig {
pub enable: bool,
pub open_api_key: String,
pub tick_interval_secs: u64,
}
Expand All @@ -36,6 +38,11 @@ pub async fn run_background_indexer(
threads: Arc<ThreadPoolNoAbort>,
config: BackgroundIndexerConfig,
) {
if !config.enable {
info!("Background indexer is disabled. Stop background indexer");
return;
}

if config.open_api_key.is_empty() {
error!("OpenAI API key is not set. Stop background indexer");
return;
Expand Down

0 comments on commit 2677aa0

Please sign in to comment.