Event not fired when called from drush

Created on 9 February 2024, 10 months ago
Updated 14 February 2024, 9 months ago

With all the versions i have tried of this module, it does not fire or recognize the events when fired from drush.

I have an advancedqueue job that dispatches a custom event, that i have made a custom CommerceEmailEvent that should be fired on that event.

If i add data to the queue and run it from Queue UI, it fires the event as it should. But if i execute the queue from drush with

drush advancedqueue:queue:process myqueue

The CommerceEmailEvent is not fired at all ?

πŸ› Bug report
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡°Denmark ramlev

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

Comments & Activities

  • Issue created by @ramlev
  • πŸ‡©πŸ‡°Denmark ramlev

    Have to say, i have another event that subscribes to that event, and it fires ok, but not the one from this module.

  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA

    @ramlev
    Set a breakpoint in the EmailSubscriber::onRequest() and see if it runs.

  • πŸ‡©πŸ‡°Denmark ramlev

    @vmarchuk not if executed with drush but from UI, yes.

  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA

    @ramlev
    I see this too, it's because $events[KernelEvents::REQUEST][] = ['onRequest', 900]; doesn't fire when you run the drush command manually. Can you try setting a cron job to run every 5 minutes (with ultimate_cron or with something similar) and let it process your queue? In the case of a cron job, onRequest should run and process your queue. Let me know the results of this test, in theory it should work.

  • πŸ‡©πŸ‡°Denmark ramlev

    As explained in my bad english, it works when fired through cron. When advancedqueue hook_cron is fired, it works but not from drush.

  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA

    @ramlev

    So in production or whatever, the queue won't be processed by cron (but how then)? If you only have trouble testing this locally (by running the drush command manually), then you need to use the ways it will work in production. As I told you before, it won't work when you run drush advancedqueue:queue:process myqueue manually, and that's expected.

  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA

    @ramlev Can this issue be closed?

  • πŸ‡©πŸ‡°Denmark ramlev

    Yes it can be closed

  • Status changed to Closed: works as designed 9 months ago
  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA
Production build 0.71.5 2024