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:
Logan
2026-06-01 01:26:54 -04:00
parent 3d51db80d0
commit 032eef311f
@@ -250,8 +250,8 @@ async def vocabulary_induction_loop() -> None:
f"interval: {settings.vocabulary_induction_interval_hours}h, "
f"sample budget: {settings.vocabulary_induction_sample_tokens} tokens"
)
await asyncio.sleep(30) # short startup grace period before first pass
while True:
await asyncio.sleep(interval)
try:
flags = await get_flags()
if flags["vocabulary_learning_enabled"]:
@@ -260,6 +260,7 @@ async def vocabulary_induction_loop() -> None:
logger.info("Vocabulary learning disabled — skipping induction pass")
except Exception as e:
logger.error(f"Vocabulary induction pass failed: {e}")
await asyncio.sleep(interval)
async def _run_induction_pass() -> None: