Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lock name on email send command #9089

Merged
merged 3 commits into from Dec 1, 2020
Merged

Conversation

mabumusa1
Copy link
Member

@mabumusa1 mabumusa1 commented Aug 15, 2020

Q A
Branch? staging
Bug fix? no
New feature? yes
Deprecations? no
BC breaks? no
Automated tests included? yes
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

This PR is fixes the failed tests for PR #8617

Add lock-name option on 'mautic:emails:send' command. This option allow to have serval email send process running in same time with different lock name.

A swiftmailler bug is fixed in this PR swiftmailer/swiftmailer#1270 to avoid send the same email twice. This modification should come with next M3 composer update.

Steps to test this PR:

  1. Load up this PR

@codecov
Copy link

codecov bot commented Aug 15, 2020

Codecov Report

Merging #9089 (ebb2415) into features (a0bff58) will increase coverage by 0.00%.
The diff coverage is 84.21%.

Impacted file tree graph

@@             Coverage Diff             @@
##             features    #9089   +/-   ##
===========================================
  Coverage       31.84%   31.85%           
- Complexity      33595    33597    +2     
===========================================
  Files            1946     1946           
  Lines          115966   115973    +7     
===========================================
+ Hits            36933    36938    +5     
- Misses          79033    79035    +2     
Impacted Files Coverage Δ Complexity Δ
...s/EmailBundle/Command/ProcessEmailQueueCommand.php 76.92% <84.21%> (-0.46%) 30.00 <0.00> (+2.00) ⬇️
.../bundles/CoreBundle/Helper/Chart/AbstractChart.php 71.76% <0.00%> (ø) 34.00% <0.00%> (ø%)

@mabumusa1
Copy link
Member Author

@Dcoutelle do you mind checking this PR, it is your PR with minor fixes

@mabumusa1
Copy link
Member Author

@RCheesley Please consider this as well

@RCheesley RCheesley added enhancement Any improvement to an existing feature or functionality T1 Low difficulty to fix (issue) or test (PR) ready-to-test PR's that are ready to test labels Aug 16, 2020
@RCheesley RCheesley added this to the 3.2 milestone Aug 16, 2020
@RCheesley
Copy link
Sponsor Member

@mabumusa1 this will be considered for 3.2 if we can get good tests :) Thanks for picking it up and making the necessary updates, we just haven't had enough time to test.

@mabumusa1 mabumusa1 self-assigned this Aug 24, 2020
@mabumusa1 mabumusa1 requested a review from kuzmany August 24, 2020 10:32
@RCheesley RCheesley added the cla-signed The PR contributors have signed the contributors agreement label Aug 25, 2020
@mabumusa1
Copy link
Member Author

@npracht will be great if you can take a quick look at this

@cla-bot
Copy link

cla-bot bot commented Oct 18, 2020

Thank you for your contribution! We require all contributors to sign our Contributor License Agreement, and we do not have a record of your signature on file. In order for us to review and merge your code, please head over to https://www.mautic.org/contributor-agreement and complete the form. There may be a short delay while the team add you as a contributor - please be patient :). Any problems contact @RCheesley. CLA has not been signed by @drprofesq.

@cla-bot cla-bot bot removed the cla-signed The PR contributors have signed the contributors agreement label Oct 18, 2020
@cla-bot cla-bot bot added the cla-signed The PR contributors have signed the contributors agreement label Oct 18, 2020
@mabumusa1 mabumusa1 changed the base branch from staging to 3.1 October 18, 2020 03:27
@mabumusa1 mabumusa1 modified the milestones: 3.2, 3.1.2 Oct 18, 2020
@Dcoutelle
Copy link
Contributor

You removed the ability to add a name to email process from #8617 ( see https://github.com/Webmecanik/mautic/blob/5c9525dacb43c75986353bcbe13ee453535ebd00/app/bundles/EmailBundle/Command/ProcessEmailQueueCommand.php#L65 ) so the goal of this PR is different.

@cla-bot
Copy link

cla-bot bot commented Oct 18, 2020

Thank you for your contribution! We require all contributors to sign our Contributor License Agreement, and we do not have a record of your signature on file. In order for us to review and merge your code, please head over to https://www.mautic.org/contributor-agreement and complete the form. There may be a short delay while the team add you as a contributor - please be patient :). Any problems contact @RCheesley. CLA has not been signed by @drprofesq.

@cla-bot cla-bot bot removed the cla-signed The PR contributors have signed the contributors agreement label Oct 18, 2020
@cla-bot
Copy link

cla-bot bot commented Oct 18, 2020

Thank you for your contribution! We require all contributors to sign our Contributor License Agreement, and we do not have a record of your signature on file. In order for us to review and merge your code, please head over to https://www.mautic.org/contributor-agreement and complete the form. There may be a short delay while the team add you as a contributor - please be patient :). Any problems contact @RCheesley. CLA has not been signed by @drprofesq.

@cla-bot cla-bot bot added the cla-signed The PR contributors have signed the contributors agreement label Oct 18, 2020
@TravisBuddy
Copy link

Travis tests have failed

Hey @mabumusa1,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

4th Build

View build log

if [ ${TRAVIS_PHP_VERSION:0:3} == "7.3" ]; then composer test -- --coverage-clover=coverage.xml; else composer test; fi
> bin/phpunit --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist '--coverage-clover=coverage.xml'
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

.............................................................   61 / 1825 (  3%)
.............................................................  122 / 1825 (  6%)
.............................................................  183 / 1825 ( 10%)
.............................................................  244 / 1825 ( 13%)
.............................................................  305 / 1825 ( 16%)
............................SS...............................  366 / 1825 ( 20%)
.............................................................  427 / 1825 ( 23%)
..................................SS.........................  488 / 1825 ( 26%)
............................................................E  549 / 1825 ( 30%)
E............................................................  610 / 1825 ( 33%)
.............................................................  671 / 1825 ( 36%)
.............................................................  732 / 1825 ( 40%)
.............................................................  793 / 1825 ( 43%)
.................................................PHP Warning:  exif_imagetype(path/to/file/1/fieldId1/upload1): failed to open stream: No such file or directory in /home/travis/build/mautic/mautic/app/bundles/FormBundle/Helper/FormUploader.php on line 154
PHP Warning:  exif_imagetype(path/to/file/2/fieldId2/upload2): failed to open stream: No such file or directory in /home/travis/build/mautic/mautic/app/bundles/FormBundle/Helper/FormUploader.php on line 154
.PHP Warning:  exif_imagetype(path/to/file/1/fieldId1/upload1): failed to open stream: No such file or directory in /home/travis/build/mautic/mautic/app/bundles/FormBundle/Helper/FormUploader.php on line 154
...........  854 / 1825 ( 46%)
...........S.................................................  915 / 1825 ( 50%)
.............................................................  976 / 1825 ( 53%)
............................................................. 1037 / 1825 ( 56%)
............................................................. 1098 / 1825 ( 60%)
............................................................. 1159 / 1825 ( 63%)
............................................................. 1220 / 1825 ( 66%)
............................................................. 1281 / 1825 ( 70%)
............................................................. 1342 / 1825 ( 73%)
............................................................. 1403 / 1825 ( 76%)
............................................................. 1464 / 1825 ( 80%)
............................................................. 1525 / 1825 ( 83%)
............................................................. 1586 / 1825 ( 86%)
............................................................. 1647 / 1825 ( 90%)
............................................................. 1708 / 1825 ( 93%)
............................................................. 1769 / 1825 ( 96%)
........................................................      1825 / 1825 (100%)

Time: 17.47 minutes, Memory: 1.17 GB

There were 2 errors:

1) Mautic\EmailBundle\Tests\Command\ProcessEmailQueueCommandTest::testCommandWhenQueueIsDisabled
Symfony\Component\Console\Exception\InvalidArgumentException: The "lock-name" option does not exist.

/home/travis/build/mautic/mautic/vendor/symfony/console/Input/Input.php:150
/home/travis/build/mautic/mautic/app/bundles/EmailBundle/Command/ProcessEmailQueueCommand.php:64
/home/travis/build/mautic/mautic/vendor/symfony/console/Command/Command.php:255
/home/travis/build/mautic/mautic/app/bundles/EmailBundle/Tests/Command/ProcessEmailQueueCommandTest.php:79

2) Mautic\EmailBundle\Tests\Command\ProcessEmailQueueCommandTest::testCommandWhenQueueIsEnabled
Symfony\Component\Console\Exception\InvalidArgumentException: The "lock-name" option does not exist.

/home/travis/build/mautic/mautic/vendor/symfony/console/Input/Input.php:150
/home/travis/build/mautic/mautic/app/bundles/EmailBundle/Command/ProcessEmailQueueCommand.php:64
/home/travis/build/mautic/mautic/vendor/symfony/console/Command/Command.php:255
/home/travis/build/mautic/mautic/app/bundles/EmailBundle/Tests/Command/ProcessEmailQueueCommandTest.php:134

ERRORS!
Tests: 1825, Assertions: 5413, Errors: 2, Skipped: 5.

Generating code coverage report in Clover XML format ... done

THE ERROR HANDLER HAS CHANGED!
Script bin/phpunit --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist handling the test event returned with error code 2
TravisBuddy Request Identifier: ba0a3ca0-1124-11eb-bfd1-1f84b849c73d

@mabumusa1
Copy link
Member Author

@Dcoutelle please review again

@Dcoutelle
Copy link
Contributor

It look like ok to me, but I don't see the difference with my original PR to male TU work ?

@mabumusa1
Copy link
Member Author

It look like ok to me, but I don't see the difference with my original PR to male TU work ?

This is your commit, it will be attributed to you. but because we did not get a reply on it #8617 (comment)

I duplicated this PR with your code to get the PR moving.

This PR should be attributed to you

@Dcoutelle
Copy link
Contributor

I don't really care about PR attribution, I wanted to know why Unit Test are working now 😛

Dcoutelle
Dcoutelle previously approved these changes Oct 18, 2020
@mabumusa1
Copy link
Member Author

@npracht this one is ready

@npracht
Copy link
Member

npracht commented Oct 18, 2020

We need a second reviewer

@npracht npracht added pending-test-confirmation PR's that require one test before they can be merged and removed ready-to-test PR's that are ready to test labels Oct 18, 2020
@npracht npracht modified the milestones: 3.1.2, 3.2 Oct 19, 2020
@RCheesley
Copy link
Sponsor Member

@mabumusa1 @Dcoutelle happy to test but there are zero test instructions on either PR. Could somebody enlighten me please?

@kuzmany
Copy link
Member

kuzmany commented Nov 21, 2020

@RCheesley This option allow to have serval email send process running in same time with different lock name.

That means If you use queue email processing you can use multiple crons command in same time:

  • mautic:email:send
  • mautic:email:send --lock-name=process2
  • mautic:email:send --lock-name=process3

etc.
Also need fix in swiftmailer https://github.com/swiftmailer/swiftmailer/pull/1270/files

It's really hard to test it properly.
You can just set queue mode in emails, and try send emails.
If you receive then should works. Same like before.

We use it in production

@npracht npracht modified the milestones: 3.2.0, 3.2.1, 3.3 Nov 23, 2020
@npracht npracht changed the base branch from 3.1 to features December 1, 2020 07:54
@npracht npracht dismissed Dcoutelle’s stale review December 1, 2020 07:54

The base branch was changed.

@npracht npracht merged commit 9713933 into mautic:features Dec 1, 2020
@mautibot
Copy link

This pull request has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/script-to-replace-the-mauticsend-cronjob/29624/7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The PR contributors have signed the contributors agreement enhancement Any improvement to an existing feature or functionality pending-test-confirmation PR's that require one test before they can be merged T1 Low difficulty to fix (issue) or test (PR)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants