memory_import_sweep
Clean up incomplete database rows after interrupted imports. Complete marked rows that have embeddings and remove those without, leaving recent or leased rows untouched.
Instructions
Admin: finish or remove rows an interrupted import left behind.
A D1 import marks each row it writes (metadata.import_attempt) until the
row is complete. A crash, or a cleanup that failed, can leave a marked
row; reads hide it. A row whose import still holds a live lease is never
touched. Otherwise this completes each marked row older than
older_than_minutes that has its embedding (the marker is stripped) and
removes each one that has none; younger markers are left alone. Also runs at the start of every import
and at server startup. Returns counts: scanned, completed, removed,
pending (of which live_lease), failed (ids).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| older_than_minutes | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |