docbrown/app/workers/articles
Daniel Uber ba590c1750
Load article before creating a page view for an invalid one (#15898)
* Load article before creating a page view for an invalid one

This should resolve a validation error in PageView.create! when the
article does not exist (perhaps it was deleted, or the user suspended,
or it was invalid data sent from the client).

This had been happening dozens of times per day for the last 10
months.

* Use an intention revealing symbol instead of calculated id

Since we only require that find_by not find anything, pass a symbol
that's not going to be the id for any article under any conditions.

As an added benefit, this provides a clear indication of the purpose
of the symbol, without needing to mentally confirm that

```sql
  SELECT * FROM articles
  WHERE id IN (
    SELECT (1 + MAX(id)) FROM articles
  ) LIMIT 1
```

actually never gives any articles back.
2021-12-29 09:48:34 -06:00
..
bust_cache_worker.rb Update bust_article to BustArticle (#11931) 2020-12-17 12:20:44 -05:00
bust_multiple_caches_worker.rb Refactor cache purging (#12811) 2021-03-02 10:09:05 -05:00
enrich_image_attributes_worker.rb Asynchronously detect image aspect ratios and apply proper attributes (#15170) 2021-10-26 13:39:25 -07:00
score_calc_worker.rb Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606) 2021-05-03 11:09:45 -04:00
update_organic_page_views_worker.rb Extract page view updates into workers (#12686) 2021-02-17 09:24:05 +07:00
update_page_views_worker.rb Load article before creating a page view for an invalid one (#15898) 2021-12-29 09:48:34 -06:00