ECA/ I'm having an issue with event scheduling

Created on 10 July 2023, over 1 year ago
Updated 11 July 2023, over 1 year ago

Hello everyone, I'm having an issue with event scheduling in the ECA module in Drupal 9. My task is to delay email sending by 30 minutes, and I'm using the 'enqueue a task with a delay' action. Below is my ECA model.

πŸ’¬ Support request
Status

Fixed

Version

1.2

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine Sharik_2023

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Sharik_2023
  • Issue was unassigned.
  • Status changed to Active over 1 year ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Thanks @Sharik_2023 for reporting this. Instead of creating screenshots, you could next time just export the model and upload that.

    As for the model, the action Enqueue a task with a delay puts a task onto the queue which will then be executed by a completely separate process. That action should not have any successor in your model, because that is executing right away.

    So, instead you should add a second event ECA processing queued task which will be triggered when queue tasks will be processed, and there you can then send your email, or whatever else you need to do.

    Note that queued tasks get either processed during Drupal's cron run or when you use drush to process the queue explicitly.

  • πŸ‡ΊπŸ‡¦Ukraine Sharik_2023

    Hello, I apologize for not responding immediately to your message. Thank you very much for your reply. I tried to do as you suggested, but it didn't work. The event is planned, but nothing happens afterwards.
    Loaded the ECA model.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    The action to send the email is using a token [commerce_order:mail] but in the context where this is running, there is no token available named commerce_order. What should be available though is a token named entity and that may be the containing the order. You can find out by using the debugging techniques that are described at https://ecaguide.org/eca/debugging/ - that will also show you what's being executed and what not and why.

    Also, you need to make sure that cron is running regularly, or you use drush queue:run eca_task:delayed_email to execute that queue explicitly.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Another thing I just noticed, your model is disabled, that may be another reason why it's not being processed.

  • πŸ‡ΊπŸ‡¦Ukraine Sharik_2023

    Thank you @jurgenhaas for your reply, it helped me solve my problem.

  • Status changed to Fixed over 1 year ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024