mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 13:22:12 +00:00
Re-instate the scheduler for the demo instances (#279)
* For the demo instance, re-instate the scheduler, but infrequently for api updates - In constants, determine the cadence based on whether it's a demo instance or not - This allow us to collect telemetry again. This will also allow us to save the chat session * Conditionally skip updating the index altogether if it's a demo isntance
This commit is contained in:
@@ -67,12 +67,14 @@ def configure_routes(app):
|
|||||||
app.include_router(web_client)
|
app.include_router(web_client)
|
||||||
|
|
||||||
|
|
||||||
@schedule.repeat(schedule.every(61).minutes)
|
if not state.demo:
|
||||||
def update_search_index():
|
|
||||||
state.search_index_lock.acquire()
|
@schedule.repeat(schedule.every(61).minutes)
|
||||||
state.model = configure_search(state.model, state.config, regenerate=False)
|
def update_search_index():
|
||||||
state.search_index_lock.release()
|
state.search_index_lock.acquire()
|
||||||
logger.info("📬 Search index updated via Scheduler")
|
state.model = configure_search(state.model, state.config, regenerate=False)
|
||||||
|
state.search_index_lock.release()
|
||||||
|
logger.info("📬 Search index updated via Scheduler")
|
||||||
|
|
||||||
|
|
||||||
def configure_search_types(config: FullConfig):
|
def configure_search_types(config: FullConfig):
|
||||||
|
|||||||
@@ -65,9 +65,8 @@ def run():
|
|||||||
logger.info("🌘 Starting Khoj")
|
logger.info("🌘 Starting Khoj")
|
||||||
|
|
||||||
if not args.gui:
|
if not args.gui:
|
||||||
if not state.demo:
|
# Setup task scheduler
|
||||||
# Setup task scheduler
|
poll_task_scheduler()
|
||||||
poll_task_scheduler()
|
|
||||||
|
|
||||||
# Start Server
|
# Start Server
|
||||||
configure_server(args, required=False)
|
configure_server(args, required=False)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ from fastapi.responses import StreamingResponse
|
|||||||
api = APIRouter()
|
api = APIRouter()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# If it's a demo instance, prevent updating any of the configuration.
|
||||||
if not state.demo:
|
if not state.demo:
|
||||||
|
|
||||||
@api.get("/config/data", response_model=FullConfig)
|
@api.get("/config/data", response_model=FullConfig)
|
||||||
|
|||||||
Reference in New Issue
Block a user