fix(android): opening the vault no longer calls the server every time

Asked plainly by the user: why does open trigger a sync? Because
OpenLocalNow displays the cache and then refreshes in the background, so a
change made on the desktop shows up without anyone thinking about it. Sound
intent, applied on EVERY open - including a lock followed by a re-open three
seconds later, which cannot learn anything new. Measured cost of one such
pointless refresh: 1 s of download and 5.5 s of key derivation.

A minimum interval between two background refreshes fixes that, whatever else
is wrong: the desktop does not publish several times a minute, and looking at
most once a quarter of an hour is enough for a change to arrive unnoticed.
Pressing Sync goes through another path and never waits.

The sha comparison that should already have made an unchanged refresh cheap is
still not firing - two fingerprints print identically yet compare unequal. It
is now compared with SameText on trimmed values, which cannot confuse two
distinct snapshots since a hex digest never differs by case or whitespace
alone, and the log reports both lengths so the invisible character shows up on
the next real refresh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-08-17 16:15:07 +01:00
parent f97e44768a
commit 65f5659d06
2 changed files with 43 additions and 2 deletions
+9 -1
View File
@@ -207,7 +207,15 @@ begin
// Meme sha : le contenu est celui qu'on detient deja. On rend la
// meme reponse qu'un 304 pour que l'appelant epargne la derivation,
// et on jette le conteneur - il ne servirait a rien.
else if (AKnownETag <> '') and (Result.ETag = AKnownETag) then
//
// COMPARAISON INSENSIBLE A LA CASSE ET AUX BLANCS. Une empreinte
// hexadecimale ne peut pas differer seulement par la casse ou par
// un espace : trancher ainsi ne peut donc pas confondre deux
// instantanes distincts, alors qu'une egalite stricte se laisse
// battre par un caractere invisible - un guillemet d'en-tete, une
// fin de ligne - et fait payer une derivation complete pour rien.
else if (AKnownETag <> '') and
SameText(Result.ETag.Trim, AKnownETag.Trim) then
begin
Result.Status := ssNotModified;
Result.Container := '';