feat: Fix loop uses sinceState instead of newSinceState, causing infinite loops.
This commit is contained in:
@@ -31,16 +31,16 @@ mixin BatchGetLabelProcessingMixin on HandleSetErrorMixin, SessionMixin {
|
||||
}
|
||||
|
||||
final maxObjects = getMaxObjectsInGetMethod(session, accountId);
|
||||
final totalEmails = labelIds.length;
|
||||
final batchSize = max(1, min(totalEmails, maxObjects));
|
||||
final totalLabels = labelIds.length;
|
||||
final batchSize = max(1, min(totalLabels, maxObjects));
|
||||
|
||||
final List<Label> allLabels = [];
|
||||
final List<Id> allNotFoundIds = [];
|
||||
State? latestState;
|
||||
|
||||
for (int start = 0; start < totalEmails; start += batchSize) {
|
||||
for (int start = 0; start < totalLabels; start += batchSize) {
|
||||
int end =
|
||||
(start + batchSize < totalEmails) ? start + batchSize : totalEmails;
|
||||
(start + batchSize < totalLabels) ? start + batchSize : totalLabels;
|
||||
final currentListIds = labelIds.sublist(start, end);
|
||||
|
||||
log('BatchGetLabelProcessingMixin::$debugLabel: processing batch ${start + 1} to $end');
|
||||
|
||||
@@ -92,10 +92,10 @@ mixin MailAPIMixin on HandleSetErrorMixin, SessionMixin {
|
||||
);
|
||||
|
||||
final listEmailIds = setEmailResponse?.updated?.keys.toEmailIds() ?? [];
|
||||
final mapErrors = handleSetResponse([setEmailResponse]);
|
||||
final batchErrors = handleSetResponse([setEmailResponse]);
|
||||
|
||||
updatedEmailIds.addAll(listEmailIds);
|
||||
mapErrors.addAll(mapErrors);
|
||||
mapErrors.addAll(batchErrors);
|
||||
}
|
||||
|
||||
return (emailIdsSuccess: updatedEmailIds, mapErrors: mapErrors);
|
||||
|
||||
@@ -22,7 +22,7 @@ mixin SessionMixin {
|
||||
maxObjectsInSetMethod,
|
||||
CapabilityIdentifierExtension.defaultMaxObjectsInSet,
|
||||
);
|
||||
log('$runtimeType::_getMaxObjectsInSetMethod:minOfMaxObjectsInSetMethod = $minOfMaxObjectsInSetMethod');
|
||||
log('$runtimeType::getMaxObjectsInSetMethod:minOfMaxObjectsInSetMethod = $minOfMaxObjectsInSetMethod');
|
||||
return minOfMaxObjectsInSetMethod;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user