Skip to content

Commit

Permalink
fix: read limit: param from sync command in sync verb handler
Browse files Browse the repository at this point in the history
  • Loading branch information
murali-shris committed Dec 13, 2024
1 parent d4e57bb commit 85f4cf4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,28 @@ class SyncProgressiveVerbHandler extends AbstractVerbHandler {
// Get Commit Log Instance.
var atCommitLog = await (AtCommitLogManagerImpl.getInstance()
.getCommitLog(AtSecondaryServerImpl.getInstance().currentAtSign));
int? skipDeletesUntil = verbParams['skipDeletesUntil'] != null
? int.parse(verbParams['skipDeletesUntil']!)
int? skipDeletesUntil = verbParams[AtConstants.skipDeletesUntil] != null
? int.parse(verbParams[AtConstants.skipDeletesUntil]!)
: null;
int? syncLimit = verbParams[AtConstants.syncLimit] != null
? int.parse(verbParams[AtConstants.syncLimit]!)
: null;
// Get entries to sync
var commitEntryIterator = atCommitLog!.getEntries(
int.parse(verbParams[AtConstants.fromCommitSequence]!) + 1,
regex: verbParams['regex'],
skipDeletesUntil: skipDeletesUntil);
Iterator<MapEntry<String, CommitEntry>> commitEntryIterator;
if (syncLimit != null) {
commitEntryIterator = atCommitLog!.getEntries(
int.parse(verbParams[AtConstants.fromCommitSequence]!) + 1,
regex: verbParams['regex'],
skipDeletesUntil: skipDeletesUntil,
limit: syncLimit);
} else {
// for backward compatibility if some old client sets isPaginated to false
// (syncLimit will not be set) in SyncVerbBuilder
commitEntryIterator = atCommitLog!.getEntries(
int.parse(verbParams[AtConstants.fromCommitSequence]!) + 1,
regex: verbParams['regex'],
skipDeletesUntil: skipDeletesUntil);
}

List<KeyStoreEntry> syncResponse = [];
await prepareResponse(capacity, syncResponse, commitEntryIterator,
Expand Down
7 changes: 7 additions & 0 deletions packages/at_secondary_server/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ dependencies:
yaml: 3.1.2
logging: 1.2.0

dependency_overrides:
at_commons:
git:
url: https://github.com/atsign-foundation/at_libraries.git
path: packages/at_commons
ref: atlookup_add_default_values_sync_builder

dev_dependencies:
build_runner: ^2.3.3
test: ^1.25.9
Expand Down
7 changes: 7 additions & 0 deletions tests/at_end2end_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ dependencies:
at_lookup: ^3.0.49
at_commons: ^5.1.0

dependency_overrides:
at_commons:
git:
url: https://github.com/atsign-foundation/at_libraries.git
path: packages/at_commons
ref: atlookup_add_default_values_sync_builder

dev_dependencies:
lints: ^5.0.0
test: ^1.25.9
Expand Down
7 changes: 7 additions & 0 deletions tests/at_functional_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ dependencies:
uuid: ^3.0.7
elliptic: ^0.3.8

dependency_overrides:
at_commons:
git:
url: https://github.com/atsign-foundation/at_libraries.git
path: packages/at_commons
ref: atlookup_add_default_values_sync_builder

dev_dependencies:
lints: ^5.0.0
test: ^1.25.9
Expand Down

0 comments on commit 85f4cf4

Please sign in to comment.