Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
363 stars 107 forks source link

Webhook Queue does not works. #240

Closed tanseercena closed 10 months ago

tanseercena commented 10 months ago

Webhook Queue does not works

Expected Behavior

Webhooks Job runs using queue added to WEBHOOKS_JOB_QUEUE varaiable.

Current Behavior

The job runs with sync, not with an added queue connection.

Failure Information

In our application QUEUE_CONNECTION=sync but WEBHOOKS_JOB_QUEUE=redis, So we use sync for all other jobs in our applications but only Shopify webhooks need to be run on redis. I debug WebhookController for config and it return redis but job was run as sync.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Add QUEUE_CONNECTION=sync and WEBHOOKS_JOB_QUEUE=redis (can be any connection)
  2. Then check for webhook jobs

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Kyon147 commented 10 months ago

Hi @tanseercena

The config is to push the webhooks jobs onto a queue on your current connection i.e a different name etc. Here's the code

($this->jobClass)::dispatch(
      $shop->getId(),
      $webhooks
 )->onQueue(Util::getShopifyConfig('job_queues')['webhooks']);

It does no support at the moment pushing them onto a different connection from your default. Feel free to open a PR if you wish to expand this.