1 Commits
Author SHA1 Message Date
sneak 6eac17b348 quak files COLLECTION fetches that collection's files alone (closes #217)
check / check (push) Canceled after 0s
`quak files COLLECTION` used to wait for a full refresh, which on an
empty cache fetched the files of every collection before it listed one.
It now reads the collection list, then calls the new
`Library.refreshCollection()`. That brings one collection up to date in
the store as a refresh would, and saves it. It runs in the same slot as
a refresh, so the two never run at the same time, and `close()` waits
for it. It never stores a collection that a refresh has already dropped.
It leaves the refresh cursor alone. `open()` therefore awaits the first
refresh on a cache whose cursor is still 0. `quak files` with no
argument still waits for a refresh.

Model: opus-5-5
2026-10-26 00:43:29 +00:00
2 changed files with 14 additions and 12 deletions

No files matched your search

+6 -5
View File
@@ -1099,11 +1099,12 @@ against a fake of the Ente HTTP API, and `yarn test` verifies them.
loop, and resolves to a `Library`. On an empty cache it awaits the first loop, and resolves to a `Library`. On an empty cache it awaits the first
refresh, so it opens onto the account's data whenever the server is reachable. refresh, so it opens onto the account's data whenever the server is reachable.
It also awaits it on a cache that holds only what `lib.refreshCollection()` It also awaits it on a cache that holds only what `lib.refreshCollection()`
stored. If that refresh fails, it opens onto what the cache holds and records stored, so it never serves one collection as the whole account. If that refresh
the error in `lib.status()`. On any other cache it returns immediately and fails, it opens onto what the cache holds and records the error in
refreshes in the background, so an unreachable server does not block opening. `lib.status()`. On any other cache it returns immediately and refreshes in the
With `refreshOnOpen: false` it starts no refresh and returns at once onto what background, so an unreachable server does not block opening. With
the cache holds, empty or not; a refresh then starts only when `fresh()` or `refreshOnOpen: false` it starts no refresh and returns at once onto what the
cache holds, empty or not; a refresh then starts only when `fresh()` or
`lib.backup()` asks, or the background timer fires. The CLI's read commands open `lib.backup()` asks, or the background timer fires. The CLI's read commands open
it so (see "CLI surface"). it so (see "CLI surface").
+8 -7
View File
@@ -944,10 +944,10 @@ export class Library {
if (changed) this.unsaved = true; if (changed) this.unsaved = true;
// Reproject and notify subscribers of the delta. This tracks RAM (what // Reproject and notify subscribers of the delta. This tracks RAM (what
// reads see), so it fires whether or not the save below succeeds. A // reads see), so it fires whether or not the save below succeeds; a
// failed save rejects the caller, and a refresh also records it in // save failure surfaces separately through `status().lastError`.
// `status().lastError`. `lastRecords` advances every changed refresh so // `lastRecords` advances every changed refresh so the next diff is
// the next diff is against current state. // against current state.
if (changed) { if (changed) {
const next = this.deriveNow(); const next = this.deriveNow();
if (this.subscribers.size > 0) { if (this.subscribers.size > 0) {
@@ -964,9 +964,10 @@ export class Library {
// Persist whenever RAM holds changes disk has not accepted — including // Persist whenever RAM holds changes disk has not accepted — including
// changes an earlier cycle staged whose save failed. `unsaved` clears // changes an earlier cycle staged whose save failed. `unsaved` clears
// only once a save lands, so a later commit retries a failed save even // only once a save lands, so a save failure both stays visible through
// when it changes nothing. A failed save rejects the caller, and a // `status().lastError` (the throw below records it) and keeps being
// refresh also records it in `status().lastError`. // retried, instead of a later empty refresh silently clearing it while
// the on-disk cache is still behind RAM.
if (this.unsaved) { if (this.unsaved) {
await this.store.save(); await this.store.save();
this.unsaved = false; this.unsaved = false;