# Changing sidekiq job urgency

**URL:** https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564
**Category:** Development
**Created:** [February 19, 2019, 4:21pm UTC](https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564 "2019-02-19T16:21:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 19, 2019, 4:21pm UTC](https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564/1 "2019-02-19T16:21:54Z")

</div>

If you’ve ever used [Topic List Previews](https://meta.discourse.org/t/topic-list-previews/101646), you may have noticed there’s a delay before the Topic List image preview includes the preview image.

The topic list image seems to be dependent on the sidekiq job `PullHotlinkedImages` which is why these plugin/themes won’t work without sidekiq running.

Recently I’ve been trying to persuade a Facebook group to move over to Discourse and whilst there are many (many!) reasons you’d do so, one of the features I like about Facebook is the almost instant image Preview you get when posting a link.

So i’m trying to increase the frequency of the `PullHotlinkedImages` so that TLP generates the Topic image asap so you don’t have to wait the usual 1 to 5 minutes for it to happen.

However, despite attempting to override the jobs code in my `plugin.rb` like so, the job still runs in the ‘low’ queue.

Any ideas?

```plaintext
after_initialize do

  Jobs.module_eval do

    class PullHotlinkedImages < Jobs::Base
      sidekiq_options queue: 'critical'

      def initialize

```

No errors in the logs, no issue starting up discourse (No errors in the console).

Am I making a newb error?

Is there a better way to override the job urgency?

PS And yes, I know I’m messing with a carefully balanced system here, but I’d still like to experiment with how far I can stress the server.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 19, 2019, 4:44pm UTC](https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564/2 "2019-02-19T16:44:12Z")

</div>

The `PullHotlinkedImages` isn’t about “almost instant image preview” but about “downloading images that are hosted elsewhere so that they don’t disappear”.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 19, 2019, 4:45pm UTC](https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564/3 "2019-02-19T16:45:06Z")

</div>

Ah, so is `topic.image_url` available sooner? Have I misunderstood how/when that is available?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 19, 2019, 5:06pm UTC](https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564/4 "2019-02-19T17:06:43Z")

</div>

The `topic.image_url` is set in [`CookedPostProcessor`](https://github.com/discourse/discourse/blob/563b95322406ac74bba136d0bb421d86f50f9ac2/lib/cooked_post_processor.rb#L475) which is called in the [`ProcessPost`](https://github.com/discourse/discourse/blob/563b95322406ac74bba136d0bb421d86f50f9ac2/app/jobs/regular/process_post.rb#L23-L24) job which is **immediately** triggered in [`PostCreator`](https://github.com/discourse/discourse/blob/e9ec5238fc2918244c9d9c9f360449111ba43242/app/models/post.rb#L704).

So if you have at least one image in your post, it should immediately (give or take a few seconds) show up at `topic.image_url`.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 19, 2019, 5:08pm UTC](https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564/5 "2019-02-19T17:08:06Z")

</div>

Thanks I’ll take another look at the delay I was experiencing. Perhaps I totally misread it. Cheers!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [February 21, 2019, 1:49pm UTC](https://meta.discourse.org/t/changing-sidekiq-job-urgency/109564/6 "2019-02-21T13:49:38Z")

</div>

Turns out this is a “bug” in TLP (which overrides and adds some methods to [CookedPostProcessor](https://github.com/discourse/discourse/blob/563b95322406ac74bba136d0bb421d86f50f9ac2/lib/cooked_post_processor.rb#L475)) and I believe I’ve found the culprit. Fix TBD.

Thanks @zogstrip for encouraging me to pursue that direction.
