Fix vocabulary induction loop running too late
The loop slept 24h before its first pass, so suggestions would never appear unless the server was up for a full day. Move the sleep to the end so the first induction pass runs ~30s after startup.
This commit is contained in:
@@ -250,8 +250,8 @@ async def vocabulary_induction_loop() -> None:
|
|||||||
f"interval: {settings.vocabulary_induction_interval_hours}h, "
|
f"interval: {settings.vocabulary_induction_interval_hours}h, "
|
||||||
f"sample budget: {settings.vocabulary_induction_sample_tokens} tokens"
|
f"sample budget: {settings.vocabulary_induction_sample_tokens} tokens"
|
||||||
)
|
)
|
||||||
|
await asyncio.sleep(30) # short startup grace period before first pass
|
||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(interval)
|
|
||||||
try:
|
try:
|
||||||
flags = await get_flags()
|
flags = await get_flags()
|
||||||
if flags["vocabulary_learning_enabled"]:
|
if flags["vocabulary_learning_enabled"]:
|
||||||
@@ -260,6 +260,7 @@ async def vocabulary_induction_loop() -> None:
|
|||||||
logger.info("Vocabulary learning disabled — skipping induction pass")
|
logger.info("Vocabulary learning disabled — skipping induction pass")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Vocabulary induction pass failed: {e}")
|
logger.error(f"Vocabulary induction pass failed: {e}")
|
||||||
|
await asyncio.sleep(interval)
|
||||||
|
|
||||||
|
|
||||||
async def _run_induction_pass() -> None:
|
async def _run_induction_pass() -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user