Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4b279cc05 |
No files matched your search
@@ -1099,12 +1099,11 @@ 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, so it never serves one collection as the whole account. If that refresh
|
stored. If that refresh fails, it opens onto what the cache holds and records
|
||||||
fails, it opens onto what the cache holds and records the error in
|
the error in `lib.status()`. On any other cache it returns immediately and
|
||||||
`lib.status()`. On any other cache it returns immediately and refreshes in the
|
refreshes in the background, so an unreachable server does not block opening.
|
||||||
background, so an unreachable server does not block opening. With
|
With `refreshOnOpen: false` it starts no refresh and returns at once onto what
|
||||||
`refreshOnOpen: false` it starts no refresh and returns at once onto what the
|
the cache holds, empty or not; a refresh then starts only when `fresh()` or
|
||||||
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").
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
// save failure surfaces separately through `status().lastError`.
|
// failed save rejects the caller, and a refresh also records it in
|
||||||
// `lastRecords` advances every changed refresh so the next diff is
|
// `status().lastError`. `lastRecords` advances every changed refresh so
|
||||||
// against current state.
|
// the next diff is 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,10 +964,9 @@ 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 save failure both stays visible through
|
// only once a save lands, so a later commit retries a failed save even
|
||||||
// `status().lastError` (the throw below records it) and keeps being
|
// when it changes nothing. A failed save rejects the caller, and a
|
||||||
// retried, instead of a later empty refresh silently clearing it while
|
// refresh also records it in `status().lastError`.
|
||||||
// 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;
|
||||||
|
|||||||
Reference in new issue
Block a user