Use new server params for group log fetch

This commit is contained in:
Fedor Indutny 2022-02-04 13:42:20 -08:00 committed by GitHub
parent 0d19f9131b
commit 6de2710841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 17 deletions

View file

@ -2541,7 +2541,16 @@ export async function respondToGroupV2Migration({
logId: `getGroupLog/${logId}`,
publicParams,
secretParams,
request: (sender, options) => sender.getGroupLog(0, options),
request: (sender, options) =>
sender.getGroupLog(
{
startVersion: 0,
includeFirstState: true,
includeLastState: false,
maxSupportedChangeEpoch: SUPPORTED_CHANGE_EPOCH,
},
options
),
});
// Attempt to start with the first group state, only later processing future updates
@ -3276,6 +3285,7 @@ async function getGroupDelta({
});
const currentRevision = group.revision;
const isFirstFetch = !isNumber(currentRevision);
let revisionToFetch = isNumber(currentRevision)
? currentRevision + 1
: undefined;
@ -3284,7 +3294,15 @@ async function getGroupDelta({
const changes: Array<Proto.IGroupChanges> = [];
do {
// eslint-disable-next-line no-await-in-loop
response = await sender.getGroupLog(revisionToFetch, options);
response = await sender.getGroupLog(
{
startVersion: revisionToFetch,
includeFirstState: isFirstFetch,
includeLastState: false,
maxSupportedChangeEpoch: SUPPORTED_CHANGE_EPOCH,
},
options
);
changes.push(response.changes);
if (response.end) {
revisionToFetch = response.end + 1;