fact-mine: progress callbacks, size-sorted queue, fix empty re-queue
Add optional progress callback to mine_transcript/mine_and_store so the daemon can display per-chunk status. Sort fact-mine queue by file size so small transcripts drain first. Write empty marker for transcripts with no facts to avoid re-queuing them. Also hardens the extraction prompt suffix.
This commit is contained in:
parent
63910e987c
commit
2aabad4eda
2 changed files with 46 additions and 23 deletions
|
|
@ -114,7 +114,8 @@ fn job_fact_mine(ctx: &ExecutionContext, path: &str) -> Result<(), TaskError> {
|
|||
run_job(ctx, &format!("fact-mine {}", path), || {
|
||||
ctx.log_line("mining facts");
|
||||
let p = std::path::Path::new(&path);
|
||||
let count = crate::fact_mine::mine_and_store(p)?;
|
||||
let progress = |msg: &str| { ctx.set_progress(msg); };
|
||||
let count = crate::fact_mine::mine_and_store(p, Some(&progress))?;
|
||||
ctx.log_line(&format!("{} facts stored", count));
|
||||
Ok(())
|
||||
})
|
||||
|
|
@ -465,6 +466,10 @@ pub fn run_daemon() -> Result<(), String> {
|
|||
}
|
||||
|
||||
// Only queue fact-mine when experience backlog is clear
|
||||
// Sort by file size so small transcripts drain first
|
||||
needs_fact.sort_by_key(|(_, path_str)| {
|
||||
fs::metadata(path_str).map(|m| m.len()).unwrap_or(u64::MAX)
|
||||
});
|
||||
let mut fact_queued = 0;
|
||||
if needs_extract.len() == extract_queued {
|
||||
let fact_budget = MAX_NEW_PER_TICK.saturating_sub(extract_queued);
|
||||
|
|
@ -551,10 +556,10 @@ pub fn run_daemon() -> Result<(), String> {
|
|||
if last.is_none_or(|d| d < today) {
|
||||
log_event("scheduler", "daily-trigger", &today.to_string());
|
||||
|
||||
// Decay (no API calls, fast)
|
||||
choir_sched.spawn(format!("decay:{}", today)).init(|ctx| {
|
||||
job_decay(ctx)
|
||||
});
|
||||
// Decay disabled — version spam and premature demotion
|
||||
// choir_sched.spawn(format!("decay:{}", today)).init(|ctx| {
|
||||
// job_decay(ctx)
|
||||
// });
|
||||
|
||||
// Consolidation pipeline: consolidate → knowledge-loop → digest
|
||||
let consolidate = choir_sched.spawn(format!("consolidate:{}", today))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue