
Problem/Motivation
Scheduled task remains in database with "reschedule" state after scheduled_email handler on webform has been deleted.
It blocks other scheduled tasks to be run via cron from webform_schedules_email module.
Watchdog registering an expectation
Drupal\Component\Plugin\Exception\PluginNotFoundException: Plugin ID 'scheduled_email' was not found. in Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin() (line 79 of /var/lib/tugboat/stm/web/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php).
On deleting schedules_email handler all existing pending actions should be "unscheduled" accordingly with
https://git.drupalcode.org/project/webform/-/blob/6.1.x/modules/webform_...
Rescheduling is happening in ScheduleEmailWebformHandler::updateHandler() in
https://git.drupalcode.org/project/webform/-/blob/6.1.x/modules/webform_...
This method is triggered by Webform::save() in
https://git.drupalcode.org/project/webform/-/blob/6.1.x/src/Entity/Webfo...
Steps to reproduce
1. Create webform
1.1 Add field of type date
1.2 Add scheduled_email handler with "Send on:" date field from previous step +1 days
1.3 Do test submission
1.4 You should see 1 scheduled email on "Email/Handlers" tab
2. Clone webform
2.1 Do test submission
2.2 You should see 1 scheduled email on "Email/Handlers" tab
3. Remove scheduled_email handler from webform created in step 1
4. Run cron
5. Check db log
Proposed resolution
Delete pending webform_schedules_email tasks on handler deleting.
Issue fork webform-3259195
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
andriyun CreditAttribution: andriyun as a volunteer and at Bellcom, Drupal Ukraine Community for Drupal Ukraine Community commentedPlease review proposed MR
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedThe change makes sense. I think the update hook could be a little simpler, and not have to load or delete individual records. Keep in mind that some websites have 100,000+ submissions
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commentedComment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at Webform module Open Collective, The Big Blue House commented