TF-4236 Misleading variable name: maxBatches represents batch size, not batch count.
This commit is contained in:
@@ -40,14 +40,14 @@ mixin BatchSetEmailProcessingMixin on HandleSetErrorMixin, MailAPIMixin {
|
|||||||
|
|
||||||
final maxObjects = getMaxObjectsInSetMethod(session, accountId);
|
final maxObjects = getMaxObjectsInSetMethod(session, accountId);
|
||||||
final totalEmails = emailIds.length;
|
final totalEmails = emailIds.length;
|
||||||
final maxBatches = min(totalEmails, maxObjects);
|
final batchSize = min(totalEmails, maxObjects);
|
||||||
|
|
||||||
final List<EmailId> updatedEmailIds = List.empty(growable: true);
|
final List<EmailId> updatedEmailIds = List.empty(growable: true);
|
||||||
final List<SetResponse> listSetResponse = List.empty(growable: true);
|
final List<SetResponse> listSetResponse = List.empty(growable: true);
|
||||||
|
|
||||||
for (int start = 0; start < totalEmails; start += maxBatches) {
|
for (int start = 0; start < totalEmails; start += batchSize) {
|
||||||
int end =
|
int end =
|
||||||
(start + maxBatches < totalEmails) ? start + maxBatches : totalEmails;
|
(start + batchSize < totalEmails) ? start + batchSize : totalEmails;
|
||||||
|
|
||||||
log('EmailAPI::$debugLabel:emails from ${start + 1} to $end');
|
log('EmailAPI::$debugLabel:emails from ${start + 1} to $end');
|
||||||
|
|
||||||
@@ -73,7 +73,10 @@ mixin BatchSetEmailProcessingMixin on HandleSetErrorMixin, MailAPIMixin {
|
|||||||
SetEmailResponse.deserialize,
|
SetEmailResponse.deserialize,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (setEmailResponse == null) continue;
|
if (setEmailResponse == null) {
|
||||||
|
log('EmailAPI::$debugLabel: Batch from ${start + 1} to $end returned null response');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final listEmailIds = setEmailResponse.updated?.keys.toEmailIds() ?? [];
|
final listEmailIds = setEmailResponse.updated?.keys.toEmailIds() ?? [];
|
||||||
updatedEmailIds.addAll(listEmailIds);
|
updatedEmailIds.addAll(listEmailIds);
|
||||||
|
|||||||
@@ -694,10 +694,10 @@ class EmailAPI with
|
|||||||
);
|
);
|
||||||
|
|
||||||
final listEmailIds = setEmailResponse?.destroyed?.toEmailIds() ?? [];
|
final listEmailIds = setEmailResponse?.destroyed?.toEmailIds() ?? [];
|
||||||
final mapErrors = handleSetResponse([setEmailResponse]);
|
final batchErrors = handleSetResponse([setEmailResponse]);
|
||||||
|
|
||||||
destroyedEmailIds.addAll(listEmailIds);
|
destroyedEmailIds.addAll(listEmailIds);
|
||||||
mapErrors.addAll(mapErrors);
|
mapErrors.addAll(batchErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (emailIdsSuccess: destroyedEmailIds, mapErrors: mapErrors);
|
return (emailIdsSuccess: destroyedEmailIds, mapErrors: mapErrors);
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ class NotParsableBlobIdToEmailException implements Exception {
|
|||||||
NotParsableBlobIdToEmailException({this.ids});
|
NotParsableBlobIdToEmailException({this.ids});
|
||||||
}
|
}
|
||||||
|
|
||||||
class EmailIdListIsEmptyException implements Exception {}
|
class EmailIdsSuccessIsEmptyException implements Exception {}
|
||||||
@@ -37,7 +37,7 @@ class AddALabelToAThreadInteractor {
|
|||||||
));
|
));
|
||||||
} else if (result.emailIdsSuccess.isEmpty) {
|
} else if (result.emailIdsSuccess.isEmpty) {
|
||||||
yield Left(AddALabelToAThreadFailure(
|
yield Left(AddALabelToAThreadFailure(
|
||||||
exception: EmailIdListIsEmptyException(),
|
exception: EmailIdsSuccessIsEmptyException(),
|
||||||
labelDisplay: labelDisplay,
|
labelDisplay: labelDisplay,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ class RemoveALabelFromAThreadInteractor {
|
|||||||
));
|
));
|
||||||
} else if (result.emailIdsSuccess.isEmpty) {
|
} else if (result.emailIdsSuccess.isEmpty) {
|
||||||
yield Left(RemoveALabelFromAThreadFailure(
|
yield Left(RemoveALabelFromAThreadFailure(
|
||||||
exception: EmailIdListIsEmptyException(),
|
exception: EmailIdsSuccessIsEmptyException(),
|
||||||
labelDisplay: labelDisplay,
|
labelDisplay: labelDisplay,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ extension AddLabelToThreadExtension on ThreadDetailController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void toggleLabelToThread(
|
void toggleLabelToThread(
|
||||||
Label label,{
|
Label label, {
|
||||||
required bool isSelected,
|
required bool isSelected,
|
||||||
List<EmailId>? currentEmailIds,
|
List<EmailId>? currentEmailIds,
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user