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 totalEmails = emailIds.length;
|
||||
final maxBatches = min(totalEmails, maxObjects);
|
||||
final batchSize = min(totalEmails, maxObjects);
|
||||
|
||||
final List<EmailId> updatedEmailIds = 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 =
|
||||
(start + maxBatches < totalEmails) ? start + maxBatches : totalEmails;
|
||||
(start + batchSize < totalEmails) ? start + batchSize : totalEmails;
|
||||
|
||||
log('EmailAPI::$debugLabel:emails from ${start + 1} to $end');
|
||||
|
||||
@@ -73,7 +73,10 @@ mixin BatchSetEmailProcessingMixin on HandleSetErrorMixin, MailAPIMixin {
|
||||
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() ?? [];
|
||||
updatedEmailIds.addAll(listEmailIds);
|
||||
|
||||
@@ -694,10 +694,10 @@ class EmailAPI with
|
||||
);
|
||||
|
||||
final listEmailIds = setEmailResponse?.destroyed?.toEmailIds() ?? [];
|
||||
final mapErrors = handleSetResponse([setEmailResponse]);
|
||||
final batchErrors = handleSetResponse([setEmailResponse]);
|
||||
|
||||
destroyedEmailIds.addAll(listEmailIds);
|
||||
mapErrors.addAll(mapErrors);
|
||||
mapErrors.addAll(batchErrors);
|
||||
}
|
||||
|
||||
return (emailIdsSuccess: destroyedEmailIds, mapErrors: mapErrors);
|
||||
|
||||
@@ -24,4 +24,4 @@ class NotParsableBlobIdToEmailException implements Exception {
|
||||
NotParsableBlobIdToEmailException({this.ids});
|
||||
}
|
||||
|
||||
class EmailIdListIsEmptyException implements Exception {}
|
||||
class EmailIdsSuccessIsEmptyException implements Exception {}
|
||||
@@ -37,7 +37,7 @@ class AddALabelToAThreadInteractor {
|
||||
));
|
||||
} else if (result.emailIdsSuccess.isEmpty) {
|
||||
yield Left(AddALabelToAThreadFailure(
|
||||
exception: EmailIdListIsEmptyException(),
|
||||
exception: EmailIdsSuccessIsEmptyException(),
|
||||
labelDisplay: labelDisplay,
|
||||
));
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ class RemoveALabelFromAThreadInteractor {
|
||||
));
|
||||
} else if (result.emailIdsSuccess.isEmpty) {
|
||||
yield Left(RemoveALabelFromAThreadFailure(
|
||||
exception: EmailIdListIsEmptyException(),
|
||||
exception: EmailIdsSuccessIsEmptyException(),
|
||||
labelDisplay: labelDisplay,
|
||||
));
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ extension AddLabelToThreadExtension on ThreadDetailController {
|
||||
}
|
||||
|
||||
void toggleLabelToThread(
|
||||
Label label,{
|
||||
Label label, {
|
||||
required bool isSelected,
|
||||
List<EmailId>? currentEmailIds,
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user