Skip to content

Archive tasks #2

@xiaolong-y

Description

@xiaolong-y

Simple mechanism to keep loading minimal with growing task size:

// tasks.json - active tasks only (fast to load)
// archive.json - completed/dropped tasks (loaded on demand)

fn archive_old_tasks(&mut self) {
    let cutoff = Utc::now() - Duration::days(7);
    let (active, archive): (Vec<_>, Vec<_>) = self.tasks
        .drain(..)
        .partition(|t| t.completed_at.map_or(true, |d| d > cutoff));
    
    self.tasks = active;
    append_to_archive(archive);
}

This keeps active JSON small (<100 tasks typically) while preserving history. The history.jsonl you already have could serve this purpose — just need a command like eq archive or auto-archive on completed tasks older than N days.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions