@@ -315,22 +315,24 @@ pub async fn init_state(config: &Config) -> Result<AppState, Error> {
315
315
) ) ;
316
316
317
317
let mailer = get_mailer ( & config. mailer ) . await ?;
318
- info ! ( "Setting up background notification worker..." ) ;
319
- let email_notification_interval = config. notification . email_notification_interval_secs ;
320
- let email_notification_grace_period = config. notification . email_notification_grace_period_secs ;
321
- let task_appflowy_web_url = config. appflowy_web_url . clone ( ) ;
322
- let task_mailer = mailer. clone ( ) ;
323
- let task_pg_pool = pg_pool. clone ( ) ;
324
- tokio:: spawn ( async move {
325
- let email_notification_worker = EmailNotificationWorker :: new (
326
- task_pg_pool,
327
- task_mailer,
328
- email_notification_interval,
329
- email_notification_grace_period,
330
- & task_appflowy_web_url,
331
- ) ;
332
- email_notification_worker. start_task ( ) . await ;
333
- } ) ;
318
+ if config. notification . enable_email_notification {
319
+ info ! ( "Setting up background notification worker..." ) ;
320
+ let email_notification_interval = config. notification . email_notification_interval_secs ;
321
+ let email_notification_grace_period = config. notification . email_notification_grace_period_secs ;
322
+ let task_appflowy_web_url = config. appflowy_web_url . clone ( ) ;
323
+ let task_mailer = mailer. clone ( ) ;
324
+ let task_pg_pool = pg_pool. clone ( ) ;
325
+ tokio:: spawn ( async move {
326
+ let email_notification_worker = EmailNotificationWorker :: new (
327
+ task_pg_pool,
328
+ task_mailer,
329
+ email_notification_interval,
330
+ email_notification_grace_period,
331
+ & task_appflowy_web_url,
332
+ ) ;
333
+ email_notification_worker. start_task ( ) . await ;
334
+ } ) ;
335
+ }
334
336
335
337
info ! ( "Setting up Indexer scheduler..." ) ;
336
338
let ( open_ai_config, azure_ai_config) = get_open_ai_config ( ) ;
0 commit comments