# How best to queue a long-running job

**URL:** <https://meta.discourse.org/t/how-best-to-queue-a-long-running-job/173533>\
**Category:** Development\
**Created:** [December 16, 2020, 9:04pm UTC](https://meta.discourse.org/t/how-best-to-queue-a-long-running-job/173533 "2020-12-16T21:04:29Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [December 16, 2020, 9:04pm UTC](https://meta.discourse.org/t/how-best-to-queue-a-long-running-job/173533/1 "2020-12-16T21:04:29Z")

</div>

So I’ve got a plugin that kicks off Ansible to do a Discourse installation (I really, really, want to stop using WordPress to take [installation orders](https://www.literatecomputing.com/discourse-installation-packages/)!).

Initially, I was calling `fork` to kick it off, which worked fine in testing, but I thought that I should do it a more “Discourse Way”.

So then made a once-off job to run the process, but it gets killed like this:

```
E, [2020-12-16T12:53:39.662683 #3158277] ERROR -- : worker=0 PID:3158425 timeout (61s > 60s), killing

```

I tried adding `sidekiq_options queue: 'low'` to the class, and then to the function that runs the job.

Then I skipped having the job run the process, and just ran it directly in the model with

```
         Discourse::Utils.execute_command(*instructions)

```

It works just fine if I run it from `rails c`, but however I run it (this is a Ubuntu development environment, started with `./bin/unicorn`, it gets killed.

---

_[View the full topic](https://meta.discourse.org/t/how-best-to-queue-a-long-running-job/173533)._
