-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit eb6e2a3 Author: bencroker <[email protected]> Date: Sat Mar 9 10:24:17 2024 -0600 Deprecate methods commit 681276f Author: bencroker <[email protected]> Date: Sat Mar 9 10:13:10 2024 -0600 Fix SendoutBatcher implementation, curly quotes commit afdd7b4 Author: bencroker <[email protected]> Date: Sat Mar 9 09:08:29 2024 -0600 Revert method removal commit 372ce05 Author: bencroker <[email protected]> Date: Sat Mar 9 08:57:58 2024 -0600 Refactor to SendoutBatcher commit 8b791ce Author: bencroker <[email protected]> Date: Sat Mar 9 08:54:59 2024 -0600 Adds faster calculation of expected recipients commit d641372 Author: bencroker <[email protected]> Date: Fri Mar 8 20:24:19 2024 -0600 Revert the fix, back to square 1 commit cffeae2 Merge: 6a3f170 b58bda0 Author: Ben Croker <[email protected]> Date: Fri Mar 8 19:42:20 2024 -0600 Merge pull request #456 from kennethormandy/contacts-batch-query Updates contacts query for large lists commit 6a3f170 Author: bencroker <[email protected]> Date: Fri Mar 8 19:36:05 2024 -0600 Fix too many parameters MySQL acccepts at most 65535 parameters, so it is important to use a `where` clause here. commit b58bda0 Author: Ben Croker <[email protected]> Date: Fri Mar 8 19:31:31 2024 -0600 Remove batching, code cleanup commit d267fbe Author: Ben Croker <[email protected]> Date: Fri Mar 8 18:54:44 2024 -0600 Revert changes commit 57e808a Merge: 4b83e5c f289a4b Author: Ben Croker <[email protected]> Date: Fri Mar 8 18:45:24 2024 -0600 Merge pull request #455 from kennethormandy/bugfix/missing-preflight-twig-variables Fixes missing memory limit and time limit Twig variables commit db87912 Author: Kenneth Ormandy <[email protected]> Date: Fri Mar 8 12:46:58 2024 -0800 Adds batch query when querying regular sendout recipients commit 11cfb80 Author: Kenneth Ormandy <[email protected]> Date: Fri Mar 8 12:44:26 2024 -0800 Adds faster calculation of expected recipients for regular sendouts
- Loading branch information
Showing
15 changed files
with
176 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace putyourlightson\campaign\batchers; | ||
|
||
use craft\base\Batchable; | ||
use putyourlightson\campaign\Campaign; | ||
use putyourlightson\campaign\elements\SendoutElement; | ||
|
||
/** | ||
* @since 2.13.0 | ||
*/ | ||
class SendoutBatcher implements Batchable | ||
{ | ||
public function __construct( | ||
private ?SendoutElement $sendout, | ||
) { | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function count(): int | ||
{ | ||
if ($this->sendout === null) { | ||
return 0; | ||
} | ||
|
||
// Return the number of pending plus sent recipients. | ||
$pendingRecipientCount = Campaign::$plugin->sendouts->getPendingRecipientCount($this->sendout); | ||
|
||
return $pendingRecipientCount + $this->sendout->recipients; | ||
} | ||
|
||
/** | ||
* Returns a batch of pending recipients, using the limit and ignoring the offset, since the pending recipients array is calculated fresh each time. | ||
*/ | ||
public function getSlice(int $offset, int $limit): iterable | ||
{ | ||
return Campaign::$plugin->sendouts->getPendingRecipients($this->sendout, $limit); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.