mass email max per batch
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"jobSchedulingMap": {
|
||||
"ProcessMassEmail": "15 * * * *",
|
||||
"ProcessMassEmail": "10,30,50 * * * *",
|
||||
"ControlKnowledgeBaseArticleStatus": "10 1 * * *"
|
||||
},
|
||||
"jobs": {
|
||||
|
||||
@@ -108,7 +108,8 @@ class SendingProcessor
|
||||
*/
|
||||
public function process(MassEmail $massEmail, bool $isTest = false): void
|
||||
{
|
||||
$maxBatchSize = $this->config->get('massEmailMaxPerHourCount', self::MAX_PER_HOUR_COUNT);
|
||||
$hourMaxSize = $this->config->get('massEmailMaxPerHourCount', self::MAX_PER_HOUR_COUNT);
|
||||
$batchMaxSize = $this->config->get('massEmailMaxPerBatchCount');
|
||||
|
||||
if (!$isTest) {
|
||||
$threshold = new DateTime();
|
||||
@@ -122,11 +123,17 @@ class SendingProcessor
|
||||
])
|
||||
->count();
|
||||
|
||||
if ($sentLastHourCount >= $maxBatchSize) {
|
||||
if ($sentLastHourCount >= $hourMaxSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
$maxBatchSize = $maxBatchSize - $sentLastHourCount;
|
||||
$hourMaxSize = $hourMaxSize - $sentLastHourCount;
|
||||
}
|
||||
|
||||
$maxSize = $hourMaxSize;
|
||||
|
||||
if ($batchMaxSize) {
|
||||
$maxSize = min($batchMaxSize, $maxSize);
|
||||
}
|
||||
|
||||
$queueItemList = $this->entityManager
|
||||
@@ -136,7 +143,7 @@ class SendingProcessor
|
||||
'massEmailId' => $massEmail->getId(),
|
||||
'isTest' => $isTest,
|
||||
])
|
||||
->limit(0, $maxBatchSize)
|
||||
->limit(0, $maxSize)
|
||||
->find();
|
||||
|
||||
$templateId = $massEmail->getEmailTemplateId();
|
||||
|
||||
@@ -187,6 +187,7 @@ return [
|
||||
'theme' => 'Violet',
|
||||
'themeParams' => (object) ['navbar' => 'side'],
|
||||
'massEmailMaxPerHourCount' => 100,
|
||||
'massEmailMaxPerBatchCount' => null,
|
||||
'massEmailVerp' => false,
|
||||
'personalEmailMaxPortionSize' => 50,
|
||||
'inboundEmailMaxPortionSize' => 50,
|
||||
|
||||
@@ -161,6 +161,7 @@ return [
|
||||
'ldapUserObjectClass',
|
||||
'maxEmailAccountCount',
|
||||
'massEmailMaxPerHourCount',
|
||||
'massEmailMaxPerBatchCount',
|
||||
'massEmailSiteUrl',
|
||||
'personalEmailMaxPortionSize',
|
||||
'inboundEmailMaxPortionSize',
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
"attachmentUploadChunkSize": "Upload Chunk Size (Mb)",
|
||||
"emailMessageMaxSize": "Email Max Size (Mb)",
|
||||
"massEmailMaxPerHourCount": "Max number of emails sent per hour",
|
||||
"massEmailMaxPerBatchCount": "Max number of emails sent per batch",
|
||||
"personalEmailMaxPortionSize": "Max email portion size for personal account fetching",
|
||||
"inboundEmailMaxPortionSize": "Max email portion size for group account fetching",
|
||||
"maxEmailAccountCount": "Max number of personal email accounts per user",
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
{
|
||||
"label": "Mass Email",
|
||||
"rows": [
|
||||
[{"name": "massEmailMaxPerHourCount"}, {"name": "massEmailDisableMandatoryOptOutLink"}],
|
||||
[{"name": "massEmailOpenTracking"}, {"name": "massEmailVerp"}]
|
||||
[{"name": "massEmailMaxPerHourCount"}, {"name": "massEmailMaxPerBatchCount"}],
|
||||
[{"name": "massEmailOpenTracking"}, {"name": "massEmailVerp"}],
|
||||
[{"name": "massEmailDisableMandatoryOptOutLink"}, false]
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -565,6 +565,10 @@
|
||||
"type": "int",
|
||||
"min": 1
|
||||
},
|
||||
"massEmailMaxPerBatchCount": {
|
||||
"type": "int",
|
||||
"min": 1
|
||||
},
|
||||
"massEmailVerp": {
|
||||
"type": "bool",
|
||||
"tooltip": true
|
||||
|
||||
@@ -72,7 +72,7 @@ return [
|
||||
'name' => 'Send Mass Emails',
|
||||
'job' => 'ProcessMassEmail',
|
||||
'status' => 'Active',
|
||||
'scheduling' => '15 * * * *',
|
||||
'scheduling' => '10,30,50 * * * *',
|
||||
],
|
||||
[
|
||||
'name' => 'Auth Token Control',
|
||||
|
||||
Reference in New Issue
Block a user