Various improvements #169

Merged
schmelczer merged 78 commits from asch/saturday into main 2025-11-30 15:24:52 +00:00
2 changed files with 6 additions and 2 deletions
Showing only changes of commit 159c4704de - Show all commits

Don't download all documents when initial sync gets interrupted

Andras Schmelczer 2025-11-27 21:52:05 +00:00

View file

@ -75,6 +75,10 @@ export class Database {
Math.max(0, lastSeenUpdateId ?? 0) // the first updateId will be 1 which is the first integer after -1 Math.max(0, lastSeenUpdateId ?? 0) // the first updateId will be 1 which is the first integer after -1
); );
this.documents.forEach((doc) =>
this.lastSeenUpdateIds.add(doc.metadata?.parentVersionId)
);
this.hasInitialSyncCompleted = this.hasInitialSyncCompleted =
initialState.hasInitialSyncCompleted ?? false; initialState.hasInitialSyncCompleted ?? false;
this.logger.debug( this.logger.debug(

View file

@ -28,8 +28,8 @@ export class CoveredValues {
this.advanceMinWhilePossible(); this.advanceMinWhilePossible();
copilot-pull-request-reviewer[bot] commented 2025-11-27 22:26:20 +00:00 (Migrated from github.com)

The filter should compare against value (the input parameter) rather than this.minValue since this.minValue is updated on line 26 and may not reflect the original intent. If the goal is to filter values greater than the new minimum, this is correct but unclear.

The filter should compare against `value` (the input parameter) rather than `this.minValue` since `this.minValue` is updated on line 26 and may not reflect the original intent. If the goal is to filter values greater than the new minimum, this is correct but unclear.
} }
copilot-pull-request-reviewer[bot] commented 2025-11-30 15:03:02 +00:00 (Migrated from github.com)

Filtering the entire seenValues array on every min update could be inefficient for large arrays. Since seenValues is sorted, consider using binary search to find the first value > this.minValue and slicing from that index instead of filtering.

Filtering the entire seenValues array on every min update could be inefficient for large arrays. Since seenValues is sorted, consider using binary search to find the first value > this.minValue and slicing from that index instead of filtering.
public add(value: number): void { public add(value: number | undefined): void {
if (value < this.minValue) { if (value === undefined || value < this.minValue) {
return; return;
} }