Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Sync verb handler add limit param #2182

Merged
merged 9 commits into from
Dec 17, 2024
4 changes: 4 additions & 0 deletions packages/at_secondary_server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 3.1.2
- fix: add limit param in SyncProgressiveVerbHandler
- build[deps]: Upgraded the following package:
at_commons to v5.1.2
# 3.1.1
- fix: Store "publicKeyHash" value in the keystore
# 3.1.0
Expand Down
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
4 changes: 2 additions & 2 deletions packages/at_secondary_server/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: at_secondary
description: Implementation of secondary server.
version: 3.1.1
version: 3.1.2
repository: https://github.com/atsign-foundation/at_server
homepage: https://www.example.com
publish_to: none
Expand All @@ -19,7 +19,7 @@ dependencies:
basic_utils: 5.7.0
ecdsa: 0.1.0
encrypt: 5.0.3
at_commons: 5.1.1
at_commons: 5.1.2
at_utils: 3.0.19
at_chops: 2.2.0
at_lookup: 3.0.49
Expand Down
2 changes: 1 addition & 1 deletion tests/at_end2end_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
encrypt: 5.0.3
at_demo_data: ^1.0.3
at_lookup: ^3.0.49
at_commons: ^5.1.0
at_commons: ^5.1.2

dev_dependencies:
lints: ^5.0.0
Expand Down
3 changes: 2 additions & 1 deletion tests/at_functional_test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ dependencies:
at_demo_data: ^1.1.0
at_chops: ^2.2.0
at_lookup: ^3.0.49
at_commons: ^5.1.0
at_commons: ^5.1.2
uuid: ^3.0.7
elliptic: ^0.3.8


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