quak files COLLECTION fetches that collection's files alone (closes #217)
check / check (push) Waiting to run
check / check (push) Waiting to run
`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()`, which brings that one collection up to date in the store as a refresh would, and saves it. It sends no request for the files when the stored copy is current, and it keeps a newer copy that a refresh stores while it fetches. It leaves the refresh cursor alone, so the next refresh still fetches every other collection that changed. `quak files` with no argument still waits for a refresh. Model: opus-5-5
This commit is contained in:
@@ -685,17 +685,20 @@ library. The read commands — `collections`, `files`, `get`, `get-thumb`,
|
||||
`helper fix-missing-thumbnails` — force a fresh server round-trip before they
|
||||
answer, so they report current account state rather than whatever the cache last
|
||||
held. `collections` asks the server for the collection list alone, in one
|
||||
request, and neither fetches any collection's files nor changes the cache. The
|
||||
others wait for a refresh. With an empty cache, as on a first run, that refresh
|
||||
fetches the files of every collection, one collection after another, and stores
|
||||
nothing until it has them all, which on a large account takes a while. Meanwhile
|
||||
the command logs a line on stderr for each collection whose files it has
|
||||
fetched, such as `Fetched the files of 3 of 120 collections`, with `--json` too;
|
||||
`backup` does the same while the refresh it starts with runs. stdout holds only
|
||||
the command's output. If that round-trip fails, the command prints the error on
|
||||
one line and exits 1, or 3 when the server no longer accepts the saved session
|
||||
(see "Session handling"). An album or file quak cannot decrypt does not fail it;
|
||||
the command answers from what did decrypt (see "Default reads vs. fresh reads").
|
||||
request, and neither fetches any collection's files nor changes the cache.
|
||||
`files` with a collection ID asks for the collection list the same way, then for
|
||||
the files of that collection alone, and stores them in the cache. It asks for
|
||||
none of them when the cache's copy of that collection is current. The others
|
||||
wait for a refresh. With an empty cache, as on a first run, that refresh fetches
|
||||
the files of every collection, one collection after another, and stores nothing
|
||||
until it has them all, which on a large account takes a while. Meanwhile the
|
||||
command logs a line on stderr for each collection whose files it has fetched,
|
||||
such as `Fetched the files of 3 of 120 collections`, with `--json` too; `backup`
|
||||
does the same while the refresh it starts with runs. stdout holds only the
|
||||
command's output. If that round-trip fails, the command prints the error on one
|
||||
line and exits 1, or 3 when the server no longer accepts the saved session (see
|
||||
"Session handling"). An album or file quak cannot decrypt does not fail it; the
|
||||
command answers from what did decrypt (see "Default reads vs. fresh reads").
|
||||
`--cache-dir` overrides where the cache lives; without it each account gets its
|
||||
own directory under the per-user cache path.
|
||||
|
||||
@@ -1180,6 +1183,15 @@ since the stored copy, so a collection stored without its files would never get
|
||||
them. `quak collections` uses it (issue
|
||||
https://git.eeqj.de/sneak/quak/issues/210).
|
||||
|
||||
`await lib.refreshCollection(collection)` brings one collection up to date in
|
||||
the cache, given its `Collection` from `freshCollections()`. It does for that
|
||||
collection what a refresh does for a changed one, and fetches no other
|
||||
collection's files. It sends no request when the cache's copy has the same
|
||||
`updationTime`. Otherwise it fetches the collection's files changed since that
|
||||
copy, or all of them when there is none, then stores and saves them. The refresh
|
||||
cursor stays where it was, so the next refresh still fetches the files of every
|
||||
other collection that changed. `quak files` with a collection ID uses it.
|
||||
|
||||
An album or file in the server's answer that quak cannot decrypt, or whose
|
||||
metadata is not JSON, does not fail the refresh. The refresh leaves it out, an
|
||||
album with all its files, and drops any older copy the cache held, so reads
|
||||
|
||||
Reference in New Issue
Block a user