From 9ba173bc2dc6ceb9434aac8d011a6e9e3fdf563c Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Wed, 11 Oct 2023 17:12:03 -0700 Subject: [PATCH] Improve emoji, message on content index updated via logger Use mailbox closed with flag down once content index completed. Use standard, existing logger messages in new indexer messages, when files to index sent by clients --- src/khoj/configure.py | 2 +- src/khoj/routers/api.py | 2 +- src/khoj/routers/indexer.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/khoj/configure.py b/src/khoj/configure.py index c978735e..7b2b3ce2 100644 --- a/src/khoj/configure.py +++ b/src/khoj/configure.py @@ -117,7 +117,7 @@ if not state.demo: state.content_index = configure_content( state.content_index, state.config.content_type, all_files, state.search_models ) - logger.info("📬 Content index updated via Scheduler") + logger.info("📪 Content index updated via Scheduler") except Exception as e: logger.error(f"🚨 Error updating content index via Scheduler: {e}", exc_info=True) diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py index db88324a..5dd60a51 100644 --- a/src/khoj/routers/api.py +++ b/src/khoj/routers/api.py @@ -622,7 +622,7 @@ def update( if state.processor_config: components.append("Conversation processor") components_msg = ", ".join(components) - logger.info(f"📬 {components_msg} updated via API") + logger.info(f"📪 {components_msg} updated via API") update_telemetry_state( request=request, diff --git a/src/khoj/routers/indexer.py b/src/khoj/routers/indexer.py index f5b2b418..94fc392d 100644 --- a/src/khoj/routers/indexer.py +++ b/src/khoj/routers/indexer.py @@ -85,6 +85,7 @@ async def index_batch( index_batch_request = IndexBatchRequest.parse_raw(index_batch_request_acc) logger.info(f"Received {len(index_batch_request.files)} files") + logger.info("📬 Updating content index via API") org_files: Dict[str, str] = {} markdown_files: Dict[str, str] = {} pdf_files: Dict[str, str] = {} @@ -115,7 +116,7 @@ async def index_batch( ) if state.config == None: - logger.info("First run, initializing state.") + logger.info("📬 Initializing content index on first run.") default_full_config = FullConfig( content_type=None, search_type=SearchConfig.parse_obj(constants.default_config["search-type"]), @@ -148,9 +149,10 @@ async def index_batch( ) except Exception as e: - logger.error(f"Failed to process batch indexing request: {e}", exc_info=True) + logger.error(f"🚨 Failed to update content index via API: {e}", exc_info=True) finally: state.config_lock.release() + logger.info("📪 Content index updated via API") return Response(content="OK", status_code=200)