Answers.Body: <ul>
  <li><p><code>queue/run</code> - should be used if you're going to manually execute this command via a <code>cron</code> job or such, because it runs any pending queue jobs, then exits</p></li>
  <li><p><code>queue/listen</code> - should be used if you want it to constantly poll (with a reasonable cooldown interval) for new jobs, and run them, because it runs a <code>listen</code> process that spawns a sub-process to run queue jobs as they come in</p></li>
  </ul>
  
  <p>More here: <a href="https://nystudio107.com/blog/robust-queue-job-handling-in-craft-cms" rel="nofollow noreferrer">Robust queue job handling in Craft CMS</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-22T12:06:27.007Z
Answers.Text: Thank you! Why you didn't mention the `queue/run` cron job solution in your article? Are there downsides using it instead of setting up a service with systemd?
Answers.UserDisplayName: Romain P.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-22T17:42:06.137Z
Answers.Text: It's just a bit less elegant but it should work fine.
Answers.UserDisplayName: andrew.welch
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-19T12:00:53.280Z
Answers.LastActivityDate: 2019-08-19T12:00:53.280Z
Answers.UserDisplayName: andrew.welch
Body: <p><strong>Definitions from the <a href="https://docs.craftcms.com/api/v3/craft-queue-queue.html#public-methods" rel="nofollow noreferrer">documentation</a>:</strong></p>
  
  <ul>
  <li><code>queue/run</code>: runs all the queued-up jobs</li>
  <li><code>queue/listen</code>: listens to
  the queue and runs new jobs</li>
  </ul>
  
  <p><strong>Example case:</strong></p>
  
  <p>The <code>runQueueAutomatically</code> config option is set to false, and a cron job is calling <code>queue/run</code> every minute: <code>/1 * * * * /path/to/project/root/craft queue/run</code>.</p>
  
  <p>In this case:</p>
  
  <ul>
  <li>Should I run <code>queue/listen</code> instead of <code>queue/run</code>?</li>
  <li>Does calling a new
  <code>queue/run</code> when a <code>queue/run</code> job is potentially still in process,
  could caused queue issues?</li>
  </ul>
  
Tags: <tasks><cli><queue>
Title: When should I run queue/listen instead of queue/run?
ThreadText: # When should I run queue/listen instead of queue/run?
  
  (Asked by: username_0 on 2019-08-19)
  
  **Definitions from the [documentation](https://docs.craftcms.com/api/v3/craft-queue-queue.html#public-methods):**
  
  * `queue/run`: runs all the queued-up jobs
  * `queue/listen`: listens to
    the queue and runs new jobs
  
  **Example case:**
  
  The `runQueueAutomatically` config option is set to false, and a cron job is calling `queue/run` every minute: `/1 * * * * /path/to/project/root/craft queue/run`.
  
  In this case:
  
  * Should I run `queue/listen` instead of `queue/run`?
  * Does calling a new
    `queue/run` when a `queue/run` job is potentially still in process,
    could caused queue issues?
  
  **Tags:** tasks, cli, queue
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-08-19. Score: 3 | Accepted answer
  
  * `queue/run` - should be used if you're going to manually execute this command via a `cron` job or such, because it runs any pending queue jobs, then exits
  * `queue/listen` - should be used if you want it to constantly poll (with a reasonable cooldown interval) for new jobs, and run them, because it runs a `listen` process that spawns a sub-process to run queue jobs as they come in
  
  More here: [Robust queue job handling in Craft CMS](https://nystudio107.com/blog/robust-queue-job-handling-in-craft-cms)
  
  > **Comments:**
  > **username_0**: Thank you! Why you didn't mention the `queue/run` cron job solution in your article? Are there downsides using it instead of setting up a service with systemd?  
  > **username_1**: It's just a bit less elegant but it should work fine.  
  
  ---
  
  